OFFSET
1,1
EXAMPLE
prime(22) = 79 prime(33) = 137 the 11th and 12th entries.
MATHEMATICA
Prime[#]&/@Select[Range[500], PalindromeQ] (* Harvey P. Dale, Nov 24 2022 *)
PROG
(PARI) g(n) = for(x=1, n, if(ispal(x), print1(prime(x)", "))) ispal(n) = { local(len, s1, s2); n=Str(n); len=length(n)\2; s1 = left(n, len); s2 = right(n, len); if(s1 == rev(s2), return(1), return(0)) } left(str, n) = \ Get the left n characters from string str. { local(v, tmp, x); v =""; tmp = Vec(str); ln=length(tmp); if(n > ln, n=ln); for(x=1, n, v=concat(v, tmp[x]); ); return(v) } right(str, n) = \ Get the right n characters from string str. { local(v, ln, s, x); v =""; tmp = Vec(str); ln=length(tmp); if(n > ln, n=ln); s = ln-n+1; for(x=s, ln, v=concat(v, tmp[x]); ); return(v) } rev(str) = \ Get the reverse of the input string { local(tmp, s, j); tmp = Vec(Str(str)); s=""; forstep(j=length(tmp), 1, -1, s=concat(s, tmp[j])); return(s) }
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Cino Hilliard, May 03 2005
STATUS
approved