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.

Showing 1-3 of 3 results.

A179550 Primes p such that p plus or minus the sum of its digits squared yields a prime in both cases.

Original entry on oeis.org

13, 127, 457, 1429, 1553, 1621, 2273, 2341, 2837, 4129, 4231, 4561, 4813, 5119, 5519, 5531, 6121, 6451, 6547, 8161, 8167, 8219, 8237, 8783, 8819, 8831, 8941, 9511, 10267, 10559, 11299, 11383, 12809, 13183, 15091, 15569, 16573, 17569, 17659, 18133
Offset: 1

Views

Author

Carmine Suriano, Jul 19 2010

Keywords

Examples

			a(5)=1553 since 1553+(1^2+5^2+5^2+3^2)=1553+60=1613 is a prime AND 1553-(1^2+5^2+5^2+3^2)=1553-60=1493 is a prime again.
		

Crossrefs

Programs

  • Maple
    filter:= proc(p) local t,r;
    if not isprime(p) then return false fi;
    r:= add(t^2, t=convert(p,base,10));
    isprime(p+r) and isprime(p-r);
    end proc:
    select(filter, [seq(i,i=3..20000,2)]); # Robert Israel, Mar 30 2021
  • Mathematica
    Select[Prime[Range[2100]],AllTrue[#+{Total[IntegerDigits[#]^2],-Total[ IntegerDigits[ #]^2]},PrimeQ]&] (* Harvey P. Dale, Aug 07 2021 *)
  • PARI
    sumdd(n) = {digs = digits(n, 10); return (sum(i=1, #digs, digs[i]^2));}
    lista(nn) = {forprime(p=2, nn, s = sumdd(p); if (isprime(p+s) && isprime(p-s), print1(p, ", ")););} \\ Michel Marcus, Jul 25 2013
    
  • Python
    from sympy import isprime, primerange
    def sumdd(n): return sum(int(d)**2 for d in str(n))
    def list(nn):
      for p in primerange(2, nn+1):
        s = sumdd(p)
        if isprime(p-s) and isprime(p+s): print(p, end=", ")
    list(18133) # Michael S. Branicky, Mar 30 2021 after Michel Marcus

A342958 a(n) is the least prime that starts a string of exactly n primes p_1, p_2, ... p_n where p_{i+1} = p_i-A003132(p_i), but p_n-A003132(p_n) is not prime.

Original entry on oeis.org

2, 13, 547, 10559, 246349, 20020109, 20020163
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Mar 31 2021

Keywords

Comments

No further terms < 10^9.

Examples

			a(3) = 547 because 547, 547-A003132(547) = 457, and 457-A003132(457) = 367 are prime, but 367-A003132(367) = 273 is not prime.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) option remember; local t, x;
      x:= n - add(t^2, t=convert(n, base, 10));
      if not isprime(x) then 1 else 1+procname(x) fi
    end proc:
    V:= Vector(7): count:= 0: p:= 1:
    while count < 7 do
      p:= nextprime(p); v:= f(p);
      if v <= N and V[v] = 0 then V[v]:= p; count:= count+1 fi
    od:
    convert(V, list);

A342960 Primes p such that p+A003132(p),(p+A003132(p))+A003132(p+A003132(p)), p-A003132(p), and (p-A003132(p))-A003132(p-A003132(p)) are prime.

Original entry on oeis.org

38377, 70957, 106867, 278177, 278393, 380377, 432199, 435763, 526397, 1093159, 2025577, 2761147, 3068119, 3656129, 3672659, 5649079, 6863173, 7366453, 8083937, 9015863, 9346507, 9497353, 14198467, 15099901, 15467423, 15479273, 16020607, 16437427, 17602547, 18804173, 20020019, 20794141, 22866121
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Mar 31 2021

Keywords

Comments

The number of digits of p that are not divisible by 3 is divisible by 3.

Examples

			a(3) = 106867 is a term because 106867, 106867+A003132(106867) = 107053, 107053+A003132(107053) = 107137, 106867-A003132(106867) = 106681, and 106681-A003132(106681) = 106543 are all prime.
		

Crossrefs

Contained in A179549 and A179550.
Cf. A003132.

Programs

  • Maple
    filter:= proc(n) local t,x,d;
      if not isprime(n) then return false fi;
      d:= add(t^2, t=convert(n,base,10));
      x:= n+d;
      if not isprime(x) then return false fi;
      if not isprime(x+add(t^2,t=convert(x,base,10))) then return false fi;
      x:= n-d;
      isprime(x) and isprime(x-add(t^2,t=convert(x,base,10)))
    end proc:
    select(filter, [seq(i,i=3..3*10^7,2)]);
Showing 1-3 of 3 results.