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.

A159477 a(n) = smallest prime >= n, if 1 is counted as a prime.

Original entry on oeis.org

1, 2, 3, 5, 5, 7, 7, 11, 11, 11, 11, 13, 13, 17, 17, 17, 17, 19, 19, 23, 23, 23, 23, 29, 29, 29, 29, 29, 29, 31, 31, 37, 37, 37, 37, 37, 37, 41, 41, 41, 41, 43, 43, 47, 47, 47, 47, 53, 53, 53, 53, 53, 53, 59, 59, 59, 59
Offset: 1

Views

Author

Jaroslav Krizek, Apr 13 2009

Keywords

Crossrefs

Cf. A008578.
Essentially the same as A066169 and A007918.

Programs

  • Haskell
    a159477 n = a159477_list !! (n-1)
    a159477_list = 1 : concat
       (zipWith (\p q -> replicate (fromInteger $ (q - p)) q)
                a008578_list $ tail a008578_list)
    -- Reinhard Zumkeller, Nov 09 2011
  • Mathematica
    Join[{1},NextPrime[Range[60]]] (* Harvey P. Dale, Jan 04 2012 *)

Formula

For n >= 2, a(n) = A007918(n). a(p) = p, a(c) = a(c+1), for p = primes (A000040), c = composite numbers (A002808).