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.

A319141 Prime numbers p such that p squared + p reversed is also prime.

Original entry on oeis.org

211, 223, 271, 283, 433, 463, 691, 823, 859, 2017, 2029, 2251, 2269, 2293, 2341, 2347, 2593, 2647, 2833, 2851, 2857, 2887, 4153, 4327, 4507, 4513, 4903, 6091, 6361, 6421, 6481, 6529, 6871, 6949, 8011, 8059, 8161, 8209, 8287, 8419, 8467, 8707, 8803, 8929, 8971
Offset: 1

Views

Author

Pierandrea Formusa, Sep 11 2018

Keywords

Comments

All terms == 1 (mod 6). - Robert Israel, Sep 13 2018

Examples

			271 belongs to this sequence as 271 squared is 73441 and 271 reversed is 172 and the sum of 73441 and 172 is 73613, which is prime.
		

Crossrefs

Cf. A304390.

Programs

  • Maple
    revdigs:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L));
    end proc:
    filter:= t -> isprime(t) and isprime(t^2+revdigs(t)):
    select(filter, [seq(t,t=1..10^4,6)]); # Robert Israel, Sep 13 2018
  • Mathematica
    Select[Prime@Range@1120, PrimeQ[#^2 + FromDigits[Reverse@IntegerDigits@#]] &] (* Vincenzo Librandi, Sep 14 2018 *)
  • PARI
    forprime(p=1, 9000, if(ispseudoprime(p^2 + eval(concat(Vecrev(Str(p))))), print1(p, ", "))) \\ Felix Fröhlich, Sep 12 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):
        if is_prime(i):
           r=int((str(i)[::-1]))
           t=pow(i,2)+r
           if is_prime(t):
              ris = ris+str(i)+","
    print(ris)