OFFSET
1,1
COMMENTS
It appears that all terms have an odd number of digits. - Robert Israel, Mar 24 2021
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
241 is a prime number. The sum with its reverse is 383 = 241+142, which is a palindromic prime. Thus, 241 is in this sequence.
MAPLE
revdigs:= proc(n) local i, L;
L:= convert(n, base, 10);
add(L[-i]*10^(i-1), i=1..nops(L))
end proc:
ispali:= proc(n) local L;
L:= convert(n, base, 10);
andmap(t -> L[t]=L[-t], [$1..nops(L)/2])
end proc:
filter:= proc(t) local r; r:= t + revdigs(t);
ispali(r) and isprime(r);
end proc:
select(filter, [seq(ithprime(i), i=1..10000)]); # Robert Israel, Mar 24 2021
MATHEMATICA
Select[Range[30000], PrimeQ[#] && PrimeQ[# + IntegerReverse[#]] && PalindromeQ[# + IntegerReverse[#]] &]
PROG
(PARI) isok(p) = my(q); isprime(p) && isprime(q=p+fromdigits(Vecrev(digits(p)))) && (q==fromdigits(Vecrev(digits(q)))); \\ Michel Marcus, Mar 18 2021
(Python)
from sympy import isprime, primerange
def ok(p):
t = p + int(str(p)[::-1]); strt = str(t)
return strt == strt[::-1] and isprime(t)
print([p for p in primerange(1, 28002) if ok(p)]) # Michael S. Branicky, Mar 18 2021
(Magma) [p: p in PrimesUpTo(10^6) | IsPrime(t) and Intseq(t) eq Reverse(Intseq(t)) where t is p+Seqint(Reverse(Intseq(p)))]; // Bruno Berselli, Mar 23 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Tanya Khovanova, Mar 18 2021
STATUS
approved