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.

A156828 a(1) = 2. a(n) = the smallest prime >= a(n-1) + 4.

Original entry on oeis.org

2, 7, 11, 17, 23, 29, 37, 41, 47, 53, 59, 67, 71, 79, 83, 89, 97, 101, 107, 113, 127, 131, 137, 149, 157, 163, 167, 173, 179, 191, 197, 211, 223, 227, 233, 239, 251, 257, 263, 269, 277, 281, 293, 307, 311, 317, 331, 337, 347, 353, 359, 367, 373, 379, 383, 389
Offset: 1

Views

Author

Leroy Quet, Feb 16 2009

Keywords

Comments

Apparently a(n) = A025584(n) for all n>2. Verified for indices n <= 100000. - R. J. Mathar, Mar 01 2010
Assume a(n-1) is in A025584 and greater than 3. Then, if a(n) = a(n-1) + 4, a(n-1) + 2 cannot be prime, and a(n) is in A025584. Otherwise, a(n) must still be in A025584, because if it were not, a(n) would not be the smallest valid prime. - Charlie Neder, Dec 16 2018

Crossrefs

Cf. A156829.

Programs

  • Magma
    [n le 1 select 2 else NextPrime(Self(n-1)+3): n in [1..60]]; // Vincenzo Librandi, Dec 21 2018
  • Maple
    p := 2: for n from 1 to 100 do printf("%d,",p) ; p := nextprime(p+3) ; od: # R. J. Mathar, Feb 21 2009
  • Mathematica
    a[1] = 2; a[n_] := a[n] = NextPrime[a[n - 1] + 3]; Array[a, 60] (* Amiram Eldar, Dec 16 2018 *)
    NestList[NextPrime[#+3]&,2,60] (* Harvey P. Dale, Jan 05 2019 *)

Extensions

More terms from R. J. Mathar, Feb 21 2009