|
|
A103405
|
|
The 2^n-th palindromic prime.
|
|
0
|
|
|
2, 3, 7, 151, 757, 14341, 36563, 1114111, 1793971, 7256527, 115737511, 188646881, 746676647, 11984748911, 19541414591, 75174747157, 1192238322911, 1901840481091, 7382419142837, 115344262443511, 181836161638181
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
EXAMPLE
|
2, 3, 5, 7, 11, 101, 131, 151, 181, 191, 313, 353, 373, 383, 727 and 757 are the first sixteen palindromic primes.
|
|
MATHEMATICA
|
NextPalindrome[n_] := Block[ {lg = Floor@ Log[10, n] + 1, idn = IntegerDigits@ n}, If[ Union@ idn == {9}, Return[n + 2], If[lg < 2, Return[n + 1], If[ FromDigits@ Reverse@ Take[ idn, Ceiling[lg/2]] > FromDigits@ Take[ idn, -Ceiling[lg/2]], FromDigits@ Join[ Take[ idn, Ceiling[lg/2]], Reverse@ Take[ idn, Floor[lg/2]]], idfhn = FromDigits@ Take[ idn, Ceiling[lg/2]] + 1; idp = FromDigits@ Join[ IntegerDigits@ idfhn, Drop[ Reverse@ IntegerDigits@ idfhn, Mod[lg, 2]]] ]]]];
c = 0; pal = 0; Do[ While[c < 2^n, pal = NextPalindrome@ pal; If[ PrimeQ@ pal, c++ ]]; Print@ pal, {n, 0, 20}]
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|