Mini-Challenge #4: Answer

There are 93 palindromic primes with 5 digits, and zero palindromic primes with 2014 digits.

Here are all the 5-digit palindromic primes: 10301, 10501, 10601, 11311, 11411, 12421, 12721, 12821, 13331, 13831, 13931, 14341, 14741, 15451, 15551, 16061, 16361, 16561, 16661, 17471, 17971, 18181, 18481, 19391, 19891, 19991, 30103, 30203, 30403, 30703, 30803, 31013, 31513, 32323, 32423, 33533, 34543, 34843, 35053, 35153, 35353, 35753, 36263, 36563, 37273, 37573, 38083, 38183, 38783, 39293, 70207, 70507, 70607, 71317, 71917, 72227, 72727, 73037, 73237, 73637, 74047, 74747, 75557, 76367, 76667, 77377, 77477, 77977, 78487, 78787, 78887, 79397, 79697, 79997, 90709, 91019, 93139, 93239, 93739, 94049, 94349, 94649, 94849, 94949, 95959, 96269, 96469, 96769, 97379, 97579, 97879, 98389, 98689.

Congratulations to Tim and @Varkora, who were the first to send me the answer. @Varkora has shared a link to a Python program, and has even written a program which fits inside a 140 characters of a tweet:


print(len(list(filter(lambda x:str(x)==str(x)[::-1]and sum(x%y<1 for y in range(2,int(x**0.5)+1))<1,range(10**4,10**5)))))


There are no palindromic primes with an even number of digits. Why? Because all even-digit palindromic numbers are divisible by 11. A number is divisible by 11 if the alternating sum of its digits is divisible by 11. For example, 918082 is divisible by 11, because 9 − 1 + 8 − 0 + 8 − 2 = 22. Now let's apply this rule to an even-digit palindromic number, with digits abc...cba: we can see that a - b + c ... - c + b - a = 0.  This is an example of a divisibility rule.