OFFSET
1,2
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]]] ]]]];
palQ[n_Integer] := Module[{idn = IntegerDigits@n}, idn == Reverse@ idn]; lst = {}; k = 1; While[k < 10^12, If[ PrimeQ@k && palQ@PrimePi@PrimePi@k, Print@PrimePi@k; AppendTo[lst, PrimePi@k]]; k = NextPalindrome@k]; lst (* Robert G. Wilson v *)
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Tanya Khovanova, Dec 13 2006
EXTENSIONS
a(22) - a(31) from Robert G. Wilson v, Dec 14 2006
a(32)-a(33) from Donovan Johnson, Jul 19 2012
a(34) from Chai Wah Wu, Sep 12 2019
a(35)-a(39) from Chai Wah Wu, Sep 19 2019
STATUS
approved