All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Mirror, mirror (Posted on 2012-05-04)
What palindromic prime number of n digits reads the same upside down or when viewed in a mirror?

Some examples for n=2 or 3:
11, 101, 181.

How far can you go?

Rem: Only digits 0,l and 8 qualify.

Comments: ( Back to comment list | You must be logged in to post comments.)
 re: computer solution -- count by length Comment 4 of 4 |
(In reply to computer solution by Charlie)

`length count 3      2 5      1 7      4 9     1211     2613     6215    17317    39219   108721   319723   818925  23354`

Later, to compare expected numbers to the above:

There are 3^((n-1)/2) possible n-digit palindromes formed with 1, 0 and 8 that begin and end with 1.

An approximation to the number of prime numbers with n digits is 10^n/ln(10^n) - 10^(n-1)/ln(10^(n-1)) = 10^n/(ln(10)*n) - 10^(n-1)/(ln(10)*(n-1)), and this is out of 10^n such numbers, so the fraction of numbers of this length that are prime would be approximated by 1/(ln(10)*n) - 1/(10*ln(10)*n).

Multiplying this fraction by the number of palindromes, the result is 3^((n-1)/2)*(1/(ln(10)*n) - 1/(10*ln(10)*n)).

The expected number in each length category is then (rounded to an integer):

`3             05             17             29             411            913            2215            5717            15119            40521            109923            301025            830927            23080`

DEFDBL A-Z
FOR n = 3 TO 27 STEP 2
PRINT n,
expected = 3 ^ ((n - 1) / 2) * (1 / (LOG(10#) * n) - 1 / (10 * LOG(10#) * n))
expected = INT(expected + .5)
PRINT expected
NEXT

Edited on May 4, 2012, 5:24 pm
 Posted by Charlie on 2012-05-04 16:39:02

 Search: Search body:
Forums (0)