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

 


A030675
Smallest nontrivial extension of n-th palindrome which is a prime.
2
11, 23, 31, 41, 53, 61, 71, 83, 97, 113, 223, 331, 443, 557, 661, 773, 881, 991, 1013, 1117, 1213, 1319, 14107, 1511, 1613, 17107, 1811, 1913, 2027, 2129, 2221, 23201, 2423, 2521, 2621, 2729, 28201, 2927, 3037, 3137, 32303, 3331, 3433
OFFSET
1,1
LINKS
FORMULA
a(n) = A030665(A002113(n+1)). - Robert Israel, Sep 18 2018
MAPLE
lpe:= proc(n) local b, d, x;
for d from 1 do
b:= 10^d*n;
for x from b+1 to b+10^d-1 by 2 do
if isprime(x) then return x fi
od
od
end proc:
digrev:= proc(n) local L, i;
L:= convert(n, base, 10);
add(L[-i]*10^(i-1), i=1..nops(L))
end proc:
N:= 4: # to use all palindromes of up to N digits
Res:= seq(lpe(n), n=1..9):
for d from 2 to N do
if d::even then
m:= d/2;
Res:= Res, seq(lpe(n*10^m + digrev(n)), n=10^(m-1)..10^m-1);
else
m:= (d-1)/2;
Res:= Res, seq(seq(lpe(n*10^(m+1)+y*10^m+digrev(n)), y=0..9), n=10^(m-1)..10^m-1);
fi
od:
Res; # Robert Israel, Sep 18 2018
MATHEMATICA
d[n_]:=IntegerDigits[n]; Table[i=1; While[!PrimeQ[x=FromDigits[Flatten[{d[n], d[i]}]]], i=i+2]; x, {n, Select[Range[350], Reverse[x=d[#]]==x &]}] (* Jayanta Basu, May 24 2013 *)
CROSSREFS
Sequence in context: A030665 A077501 A337845 * A110786 A059642 A090920
KEYWORD
nonn,base,look
EXTENSIONS
Corrected by Robert Israel, Sep 18 2018
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | 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 September 20 20:48 EDT 2024. Contains 376078 sequences. (Running on oeis4.)