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.

A066136 Primes are replaced by their local sequence number in A000040, while composites are replaced by their sequence number in A002808; (a kind of eigen- or home-indexing).

Original entry on oeis.org

0, 1, 2, 1, 3, 2, 4, 3, 4, 5, 5, 6, 6, 7, 8, 9, 7, 10, 8, 11, 12, 13, 9, 14, 15, 16, 17, 18, 10, 19, 11, 20, 21, 22, 23, 24, 12, 25, 26, 27, 13, 28, 14, 29, 30, 31, 15, 32, 33, 34, 35, 36, 16, 37, 38, 39, 40, 41, 17, 42, 18, 43, 44, 45, 46, 47, 19, 48, 49, 50, 20, 51, 21, 52, 53
Offset: 1

Views

Author

Labos Elemer, Dec 07 2001

Keywords

Comments

Primality or compositeness is recognizable from the terms: if successor of a term(>2) is larger by one than the term, then it labels a composite number.

Crossrefs

Programs

  • Mathematica
    Do[s=n; If[PrimeQ[n], Print[PrimePi[n]]]; If[ !PrimeQ[n], Print[n-PrimePi[n]-1]], {n, 1, 1000}]
  • PARI
    a(n) = { if (isprime(n), primepi(n), n - primepi(n) - 1) } \\ Harry J. Smith, Feb 02 2010

Formula

a(n) = pi(n) if n is prime; a(n) = n-pi(n)-1 if n is not prime.
a(n) = A026238(n), n>1. - R. J. Mathar, Sep 30 2008