How many 8 digit palindromes are prime?

1.2k Views Asked by At

Find the number of primes that are 8 digit palindromes.

I got this question in a entrance paper. The only thing I know is the definition of a palindrome.

Also, is there any method/formula to count or approximate the first $n$ palindromes?

2

There are 2 best solutions below

8
On

Summarizing the hints and clarifications made in comments above:

One of the properties of prime numbers is that they cannot be divisible by any other number other than itself and $1$.

A palindrome is a number (or string) which is read the same forwards as backwards. These can be of odd length like your example of $12321$ but they can also be of even length $12344321$.

The divisibility test for $11$ should work wonders here if you can pay attention how to apply it.

The number $\overline{abcdefgh}$ is equivalent modulo $11$ to $-a+b-c+d-e+f-g+h$. That is to say, $\overline{abcdefgh}$ is a multiple of $11$ if and only if $-a+b-c+d-e+f-g+h$ is a multiple of $11$. (remember zero is a multiple of $11$)

Having used the divisibility test for $11$ will point out a crucial observation about any palindromic 8-digit number which will imply something about whether or not it can be prime.

1
On

There are none. In general, if $k$ is an even composite number, there are no prime palindromes with $k$ digits because they're all divisible by $11$. A few examples:

  • $10000001 = 11 \times 909091$
  • $10011001 = 7 \times 11 \times 13 \times 73 \times 137$
  • $10022001 = 3 \times 11 \times 83 \times 3659$
  • $10033001 = 11 \times 97 \times 9403$
  • $10044001 = 11 \times 139 \times 6569$

You get the idea.

Also, is there any method/formula to count or approximate the first $n$ palindromes?

Trying to take this question at face value, the answer is absolutely yes, there's definitely a way to approximate how many palindromic numbers there are up to a given bound, if you're not concerned that they be prime. And if the given bound is a power of $10$, then it's easy to know with certainty. If $n$ is even, then there are $$11 \times 10^{\frac{n - 1}{2}} - 1$$ palindromes up to $10^n$, and if $n$ is even, there are $$2^{\frac{n}{2 + 1}} 5^{\frac{n}{2}} - 1$$ palindromes up to $10^n$.