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.

A065377 Primes not of the form p + k^2, with p prime and k > 0.

Original entry on oeis.org

2, 5, 13, 31, 37, 61, 127, 379, 439, 571, 829, 991, 1549, 3319, 7549
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 03 2001

Keywords

Comments

Probably finite and 7549 is the last entry. - Robert G. Wilson v, Nov 05 2001
No more terms below 10^9. - Mauro Fiorentini, Mar 02 2020

Crossrefs

Cf. A000040. Complement of A065376.

Programs

  • Maple
    N:= 10^6: # to get all entries <= N
    Primes:= select(isprime,{2,seq(2*i+1,i=1..floor((N-1)/2))}):
    A:= NULL:
    for i from 1 to nops(Primes) do
    for k from floor(sqrt(Primes[i])) to 1 by -1 do
       if isprime(Primes[i] - k^2) then break fi
    od:
    if k = 0 then A:= A, Primes[i] fi;
    od:
    A; # Robert Israel, Sep 03 2014
  • Mathematica
    Do[ k = 1; p = Prime[n]; While[k^2 < p && !PrimeQ[p - k^2], k++ ]; If[k^2 > p, Print[p]], {n, 1, 10^6} ]
    Module[{nn=1000,pr},pr=Flatten[Table[Prime[n]+Range[nn]^2,{n,nn}]];Complement[Prime[Range[nn]],pr]] (* Harvey P. Dale, May 30 2014 *)
  • PARI
    is(p)=forstep(m=2,sqrtint(p),2,if(isprime(p-m^2),return(0)));isprime(p) && (p==2 || !issquare(p-2)) \\ Charles R Greathouse IV, Jun 04 2012

Extensions

Offset corrected by Charles R Greathouse IV, May 29 2012

A065396 Primes of the form p + k*(k+1) / 2, p prime and k > 0.

Original entry on oeis.org

3, 5, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 05 2001

Keywords

Comments

a(2) = 11 = 5 + 3*(3+1) / 2.

Crossrefs

Programs

  • Mathematica
    Module[{upto=300,trs},trs=Accumulate[Range[(Sqrt[1+8upto]-1)/2]];Select[ Flatten[ Table[p+trs,{p,Prime[Range[PrimePi[upto]]]}]],PrimeQ[#] && #<=upto&]]//Union (* Harvey P. Dale, Dec 16 2017 *)

A309179 Primes to which a record size square needs to be added to reach another prime.

Original entry on oeis.org

2, 3, 5, 29, 41, 389, 479, 881, 1931, 3461, 3701, 7589, 9749, 26171, 153089, 405701, 1036829, 1354349, 1516829, 2677289, 4790309, 4990961, 34648631, 46214321, 50583209, 98999969, 305094851, 331498961, 362822099, 4373372351, 11037674441, 12239355719, 16085541359
Offset: 1

Views

Author

Bert Dobbelaere, Jul 15 2019

Keywords

Comments

a(1) = 2 and r(1) = 1.
For n > 1, a(n) is the smallest prime for which r(n) > r(n-1) exists so that a(n) + r(n)^2 is prime and a(n) + k^2 are composite for 0 < k < r(n).
When omitting the squares in the description, the sequence becomes A002386.

Examples

			a(1) = 2; r(1) = 1.
a(2) = 3; 3 + 1^2 is composite, but 3 + 2^2 is prime, so r(2) = 2.
a(3) = 5; 5 + k^2 is composite for 0 < k < 6, but 5 + 6^2 is prime, so r(3) = 6.
The following are primes: 7 + 2^2, 11 + 6^2, 13 + 2^2, 17 + 6^2, 19 + 2^2, 23 + 6^2.
a(4) = 29; 29 + k^2 is composite for 0 < k < 12, but 29 + 12^2 is prime: r(4) = 12.
		

Crossrefs

Programs

  • PARI
    f(n) = {k=1; while(!isprime(n+k^2), k++); k;}
    lista(NN) = {m=0; forprime(p=1, NN, if(f(p)>m, m=f(p);print1(p,", ")))} \\ Jinyuan Wang, Jul 15 2019
  • Python
    from sympy import isprime, nextprime
    n, p, r = 0, 0, 0
    while(True):
        p = nextprime(p) ; k = 1
        while not isprime(p + k**2):
            k += 1
        if k > r:
            n += 1 ; r = k
            print("a({}) = {}".format(n,p))
    

Extensions

a(30)-a(33) from Giovanni Resta, Jul 16 2019
Showing 1-3 of 3 results.