Mathwords logoMathwords

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 pp is an emirp if three conditions hold. First, pp is prime. Second, the number R(p)R(p), formed by reversing the decimal digits of pp, is prime. Third, R(p)≠pR(p) \neq p. Because reversal is symmetric, emirps always come in pairs {p,R(p)}\{p, R(p)\}. 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 107≈10.3\sqrt{107} \approx 10.3, 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, 7×15=1057 \times 15 = 105, which leaves a remainder of 2. So 107 is prime.
107=7×15+2107 = 7 \times 15 + 2
Step 2: Reverse the digits 1, 0, 7 to get 7, 0, 1. The reversed number is 701, and it is different from 107.
R(107)=7×100+0×10+1=701R(107) = 7 \times 100 + 0 \times 10 + 1 = 701
Step 3: Check that 701 is prime. Because 701≈26.5\sqrt{701} \approx 26.5, 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.
701=7×100+1=13×53+12=23×30+11701 = 7 \times 100 + 1 = 13 \times 53 + 12 = 23 \times 30 + 11
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.

Related Terms

  • Composite Number — What a prime's reversal often turns out to be
  • Digit — Reversing the digit order defines the emirp test
  • Natural Numbers — The set every emirp and its reversal belong to
  • Even Number — Explains why no emirp can start with an even digit
  • Prime Number — Emirps are a special kind of prime number
  • Twin Primes — Another named family of special prime number pairs