login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A103404 The 10^n-th palindromic prime. 1

%I #6 Aug 25 2012 09:44:44

%S 2,191,94049,114232411,13649694631,1565887885651,175606737606571,

%T 19508150605180591

%N The 10^n-th palindromic prime.

%e 2, 3, 5, 7, 11, 101, 131, 151, 181 and 191 are the first ten palindromic primes.

%t NextPalindrome[n_] := Block[ {l = Floor[ Log[10, n] + 1], idn = IntegerDigits[n]}, If[ Union[ idn] == {9}, Return[n + 2], If[l < 2, Return[n + 1], If[ FromDigits[ Reverse[ Take[ idn, Ceiling[l/2]]]] FromDigits[ Take[ idn, -Ceiling[l/2]]], FromDigits[ Join[ Take[ idn, Ceiling[l/2]], Reverse[ Take[ idn, Floor[l/2]]] ]], idfhn = FromDigits[ Take[ idn, Ceiling[l/2]]] + 1; idp = FromDigits[ Join[ IntegerDigits[ idfhn], Drop[ Reverse[ IntegerDigits[ idfhn]], Mod[l, 2]]]] ]]]];

%t pal = 0; Do[pal = NextPalindrome[pal]; Do[While[pal = NextPalindrome[pal]; ! PrimeQ[pal], ], {i, 10^(n - 1) + 1, 10^n}]; Print[pal], {n, 0, 8}]

%Y Cf. A083816.

%K base,nonn

%O 0,1

%A _Robert G. Wilson v_, Feb 03 2005

%E a(7) from _Donovan Johnson_, Aug 25 2012

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 20:08 EDT 2024. Contains 371963 sequences. (Running on oeis4.)