Emirp — Definition & Example
An emirp is a prime number that turns into a different prime when you write its digits in reverse order. The name itself is the word "prime" spelled backward. For example, 13 and 31 are both emirps.
A natural number is an emirp if three conditions hold. First, is prime. Second, the number , formed by reversing the decimal digits of , is prime. Third, . Because reversal is symmetric, emirps always come in pairs . The smallest emirps are 13, 17, 31, 37, 71, 73, 79, and 97.
Worked Example
Problem: Is 107 an emirp?
Step 1: Check that 107 is prime. Because , you only need to test the primes 2, 3, 5, and 7. 107 is odd, so 2 fails. Its digit sum is 8, so 3 fails. It does not end in 0 or 5, so 5 fails. For 7, , which leaves a remainder of 2. So 107 is prime.
Step 2: Reverse the digits 1, 0, 7 to get 7, 0, 1. The reversed number is 701, and it is different from 107.
Step 3: Check that 701 is prime. Because , test the primes up to 23. The digit sum is 8, so 3 fails, and 2 and 5 fail right away. The remainders for 7, 11, 13, 17, 19, and 23 are 1, 8, 12, 4, 17, and 11. None of them is 0, so 701 is prime.
Answer: Yes. 107 is prime, its reversal 701 is a different prime, so 107 is an emirp. It follows that 701 is an emirp too.
Why It Matters
Emirps are a classic exercise in introductory programming courses. To find them, you combine two small algorithms: one that tests whether a number is prime and one that reverses its digits. They also appear in math-competition puzzles that ask you to spot primes from their digit patterns.
Common Mistakes
Mistake: Calling a palindromic prime such as 11, 101, or 131 an emirp because its reversal is prime.
Correction: The reversal must be a different prime. A palindromic prime reverses to itself, so it does not qualify. Also check the reversal carefully. 19 is prime, but its reversal is 91 = 7 × 13, which is composite. So 19 is not an emirp.
