OFFSET
1,1
LINKS
Seiichi Manyama, Table of n, a(n) for n = 1..5000
EXAMPLE
The prime number 227 belongs to this sequence as 722 is 227 reversed and 227^2 + 722^2 = 572813, which is prime.
MATHEMATICA
Select[Prime@ Range@ 850, PrimeQ[#^2 + FromDigits[ Reverse@ IntegerDigits@ #]^2] &] (* Giovanni Resta, Sep 03 2018 *)
PROG
(Python)
nmax=10000
def is_prime(num):
if num == 0 or num == 1: return(0)
for k in range(2, num):
if (num % k) == 0:
return(0)
return(1)
ris = ""
for i in range(nmax):
r=int((str(i)[::-1]))
t=pow(i, 2)+pow(r, 2)
if is_prime(i):
if is_prime(t):
ris = ris+str(i)+", "
print(ris)
(PARI) isok(p) = isprime(p) && isprime(p^2+eval(fromdigits(Vecrev(digits(p))))^2); \\ Michel Marcus, Aug 21 2018
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Pierandrea Formusa, Aug 16 2018
STATUS
approved