A080339 Characteristic function of {1} union {primes}: 1 if n is 1 or a prime, else 0.
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
References
- Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See p. 132.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
- Aminu Alhaji Ibrahim and Sa’idu Isah Abubaka, Aunu Integer Sequence as Non-Associative Structure and Their Graph Theoretic Properties, Advances in Pure Mathematics, 2016, 6, 409-419.
- Eric Weisstein's World of Mathematics, Prime Formulas
- Index entries for characteristic functions
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
Comments