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.

A080339 Characteristic function of {1} union {primes}: 1 if n is 1 or a prime, else 0.

Original entry on oeis.org

1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0
Offset: 1

Views

Author

N. J. A. Sloane, Mar 21 2003

Keywords

Comments

Characteristic function of noncomposite numbers (see A008578). - Omar E. Pol, Oct 07 2013

References

  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See p. 132.

Crossrefs

Cf. A036234 (partial sums).

Programs

  • Maple
    1,seq(`if`(isprime(i),1,0),i=2..100); # Robert Israel, Jan 11 2016
  • Mathematica
    Table[Which[n == 1, 1, PrimeQ[n], 1, True, 0], {n, 110}] (* Harvey P. Dale, Oct 03 2011 *)
    Table[Boole[PrimeOmega[n] < 2], {n, 100}] (* Alonso del Arte, Nov 19 2013 *)
  • PARI
    a(n) = (n==1) + isprime(n); \\ Michel Marcus, Jan 13 2016

Formula

a(1)=1, and a(n) = Prod_{k=1...n-1}(k/n)^2 where (a/b) is the Jacobi symbol and n>1. - Dimitri Papadopoulos, Jan 13 2016