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!)
A088249 Smallest palindromic prime beginning with the n-th prime, or 0 if no such prime exists. 1

%I #9 Aug 06 2020 22:06:01

%S 2,3,5,7,11,131,17471,191,0,0,313,373,0,0,0,0,0,0,0,71317,73037,797,0,

%T 0,97379,101,10301,1074701,1092901,11311,12721,131,1371731,13931,

%U 1490941,151,1572751,16361,1670761,1730371,17971,181,191,19391,1970791,19991

%N Smallest palindromic prime beginning with the n-th prime, or 0 if no such prime exists.

%C Conjecture: Except for n=1 and 3, a(n) = 0 iff prime(n) has Most Significant digit one among (2,4,5,6,8).

%H Robert Israel, <a href="/A088249/b088249.txt">Table of n, a(n) for n = 1..10000</a>

%e a(7) = 17471, prime(7) = 17. a(9) = 0, prime(9) = 23 and no such prime exists.

%p revdigs:= proc(n) local L, i;

%p L:= convert(n,base,10);

%p add(L[-i]*10^(i-1),i=1..nops(L))

%p end proc:

%p pali:= proc(n) local d;

%p d:= ilog10(n);

%p n*10^d + revdigs(floor(n/10));

%p end proc:

%p f:= proc(n) local L, Lp, x,cand,d;

%p L:= convert(n,base,10);

%p if not member(L[-1],[1,3,7,9]) then return 0 fi;

%p for d from nops(L) to 0 by -1 do

%p if L[1..d] = ListTools:-Reverse(L[1..d]) then

%p Lp:= [op(ListTools:-Reverse(L[d+1..-1])),op(L)];

%p cand:= add(Lp[i]*10^(i-1),i=1..nops(Lp));

%p if isprime(cand) then return cand fi

%p fi

%p od;

%p for d from 1 do

%p for x from 0 to 10^d-1 do

%p cand:= pali(10^d*n+x);

%p if isprime(cand) then return cand fi;

%p od;

%p od

%p end proc:

%p f(2):= 2: f(5):= 5:

%p map(f @ ithprime, [$1..100]); # _Robert Israel_, Aug 06 2020

%K base,easy,nonn,look

%O 1,1

%A _Amarnath Murthy_, Sep 26 2003

%E More terms from _Giovanni Resta_, Feb 07 2006

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 19 04:04 EDT 2024. Contains 371782 sequences. (Running on oeis4.)