login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Prime numbers p such that p squared + (p reversed) squared is also prime.
2

%I #22 Sep 03 2018 11:54:04

%S 23,41,227,233,283,401,409,419,421,461,491,499,823,827,857,877,2003,

%T 2083,2267,2437,2557,2593,2617,2633,2677,2857,2887,2957,4001,4021,

%U 4051,4079,4129,4211,4231,4391,4409,4451,4481,4519,4591,4621,4639,4651,4871,6091,6301,6329,6379,6521,6529,6551

%N Prime numbers p such that p squared + (p reversed) squared is also prime.

%H Seiichi Manyama, <a href="/A304390/b304390.txt">Table of n, a(n) for n = 1..5000</a>

%e The prime number 227 belongs to this sequence as 722 is 227 reversed and 227^2 + 722^2 = 572813, which is prime.

%t Select[Prime@ Range@ 850, PrimeQ[#^2 + FromDigits[ Reverse@ IntegerDigits@ #]^2] &] (* _Giovanni Resta_, Sep 03 2018 *)

%o (Python)

%o nmax=10000

%o def is_prime(num):

%o if num == 0 or num == 1: return(0)

%o for k in range(2, num):

%o if (num % k) == 0:

%o return(0)

%o return(1)

%o ris = ""

%o for i in range(nmax):

%o r=int((str(i)[::-1]))

%o t=pow(i,2)+pow(r,2)

%o if is_prime(i):

%o if is_prime(t):

%o ris = ris+str(i)+","

%o print(ris)

%o (PARI) isok(p) = isprime(p) && isprime(p^2+eval(fromdigits(Vecrev(digits(p))))^2); \\ _Michel Marcus_, Aug 21 2018

%Y Cf. A061783 (Luhn primes).

%Y Subsequence of A069207. - _Michel Marcus_, Aug 21 2018

%K nonn,base

%O 1,1

%A _Pierandrea Formusa_, Aug 16 2018