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.

Original entry on oeis.org

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

Views

Author

Pierandrea Formusa, Aug 16 2018

Keywords

Examples

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

Crossrefs

Cf. A061783 (Luhn primes).
Subsequence of A069207. - Michel Marcus, Aug 21 2018

Programs

  • Mathematica
    Select[Prime@ Range@ 850, PrimeQ[#^2 + FromDigits[ Reverse@ IntegerDigits@ #]^2] &] (* Giovanni Resta, Sep 03 2018 *)
  • PARI
    isok(p) = isprime(p) && isprime(p^2+eval(fromdigits(Vecrev(digits(p))))^2); \\ Michel Marcus, Aug 21 2018
  • 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)