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.

A014237 a(n) = (n-th prime) - (n-th nonprime).

Original entry on oeis.org

1, -1, -1, -1, 2, 3, 5, 5, 8, 13, 13, 17, 20, 21, 23, 28, 33, 34, 39, 41, 41, 46, 49, 54, 61, 63, 64, 67, 67, 69, 82, 85, 89, 90, 99, 100, 105, 109, 112, 117, 122, 123, 131, 131, 134, 135, 146, 157, 159, 160, 163, 167, 167, 176, 181, 186, 191, 191, 196
Offset: 1

Views

Author

Keywords

Comments

a(n) = A000040(n) - A018252(n). - Reinhard Zumkeller, Apr 30 2014

Crossrefs

Programs

  • Haskell
    a014237 n = a000040 n - a018252 n  -- Reinhard Zumkeller, Apr 30 2014
    
  • Mathematica
    nonPrime[n_Integer] := FixedPoint[n + PrimePi@# &, n+PrimePi@n];
    Table[Prime[n] - nonPrime[n], {n, 1, 70}] (* G. C. Greubel, Jun 22 2019 *)
  • Python
    from sympy import prime, composite
    def A014237(n):
        return 1 if n == 1 else prime(n)-composite(n-1) # Chai Wah Wu, Dec 27 2018