login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A088249
Smallest palindromic prime beginning with the n-th prime, or 0 if no such prime exists.
1
2, 3, 5, 7, 11, 131, 17471, 191, 0, 0, 313, 373, 0, 0, 0, 0, 0, 0, 0, 71317, 73037, 797, 0, 0, 97379, 101, 10301, 1074701, 1092901, 11311, 12721, 131, 1371731, 13931, 1490941, 151, 1572751, 16361, 1670761, 1730371, 17971, 181, 191, 19391, 1970791, 19991
OFFSET
1,1
COMMENTS
Conjecture: Except for n=1 and 3, a(n) = 0 iff prime(n) has Most Significant digit one among (2,4,5,6,8).
LINKS
EXAMPLE
a(7) = 17471, prime(7) = 17. a(9) = 0, prime(9) = 23 and no such prime exists.
MAPLE
revdigs:= proc(n) local L, i;
L:= convert(n, base, 10);
add(L[-i]*10^(i-1), i=1..nops(L))
end proc:
pali:= proc(n) local d;
d:= ilog10(n);
n*10^d + revdigs(floor(n/10));
end proc:
f:= proc(n) local L, Lp, x, cand, d;
L:= convert(n, base, 10);
if not member(L[-1], [1, 3, 7, 9]) then return 0 fi;
for d from nops(L) to 0 by -1 do
if L[1..d] = ListTools:-Reverse(L[1..d]) then
Lp:= [op(ListTools:-Reverse(L[d+1..-1])), op(L)];
cand:= add(Lp[i]*10^(i-1), i=1..nops(Lp));
if isprime(cand) then return cand fi
fi
od;
for d from 1 do
for x from 0 to 10^d-1 do
cand:= pali(10^d*n+x);
if isprime(cand) then return cand fi;
od;
od
end proc:
f(2):= 2: f(5):= 5:
map(f @ ithprime, [$1..100]); # Robert Israel, Aug 06 2020
CROSSREFS
Sequence in context: A084836 A062351 A185267 * A241724 A186449 A046480
KEYWORD
base,easy,nonn,look
AUTHOR
Amarnath Murthy, Sep 26 2003
EXTENSIONS
More terms from Giovanni Resta, Feb 07 2006
STATUS
approved