login
A304390
Prime numbers p such that p squared + (p reversed) squared is also prime.
2
23, 41, 227, 233, 283, 401, 409, 419, 421, 461, 491, 499, 823, 827, 857, 877, 2003, 2083, 2267, 2437, 2557, 2593, 2617, 2633, 2677, 2857, 2887, 2957, 4001, 4021, 4051, 4079, 4129, 4211, 4231, 4391, 4409, 4451, 4481, 4519, 4591, 4621, 4639, 4651, 4871, 6091, 6301, 6329, 6379, 6521, 6529, 6551
OFFSET
1,1
LINKS
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
Cf. A061783 (Luhn primes).
Subsequence of A069207. - Michel Marcus, Aug 21 2018
Sequence in context: A345099 A106969 A343816 * A309533 A331342 A306085
KEYWORD
nonn,base
AUTHOR
Pierandrea Formusa, Aug 16 2018
STATUS
approved