cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A304390 #22 Sep 03 2018 11:54:04
%S A304390 23,41,227,233,283,401,409,419,421,461,491,499,823,827,857,877,2003,
%T A304390 2083,2267,2437,2557,2593,2617,2633,2677,2857,2887,2957,4001,4021,
%U A304390 4051,4079,4129,4211,4231,4391,4409,4451,4481,4519,4591,4621,4639,4651,4871,6091,6301,6329,6379,6521,6529,6551
%N A304390 Prime numbers p such that p squared + (p reversed) squared is also prime.
%H A304390 Seiichi Manyama, <a href="/A304390/b304390.txt">Table of n, a(n) for n = 1..5000</a>
%e A304390 The prime number 227 belongs to this sequence as 722 is 227 reversed and 227^2 + 722^2 = 572813, which is prime.
%t A304390 Select[Prime@ Range@ 850, PrimeQ[#^2 + FromDigits[ Reverse@ IntegerDigits@ #]^2] &] (* _Giovanni Resta_, Sep 03 2018 *)
%o A304390 (Python)
%o A304390 nmax=10000
%o A304390 def is_prime(num):
%o A304390     if num == 0 or num == 1: return(0)
%o A304390     for k in range(2, num):
%o A304390        if (num % k) == 0:
%o A304390            return(0)
%o A304390     return(1)
%o A304390 ris = ""
%o A304390 for i in range(nmax):
%o A304390     r=int((str(i)[::-1]))
%o A304390     t=pow(i,2)+pow(r,2)
%o A304390     if is_prime(i):
%o A304390        if is_prime(t):
%o A304390           ris = ris+str(i)+","
%o A304390 print(ris)
%o A304390 (PARI) isok(p) = isprime(p) && isprime(p^2+eval(fromdigits(Vecrev(digits(p))))^2); \\ _Michel Marcus_, Aug 21 2018
%Y A304390 Cf. A061783 (Luhn primes).
%Y A304390 Subsequence of A069207. - _Michel Marcus_, Aug 21 2018
%K A304390 nonn,base
%O A304390 1,1
%A A304390 _Pierandrea Formusa_, Aug 16 2018