login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A010051 Characteristic function of primes: 1 if n is prime else 0. 553
0, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

The following sequences all have the same parity (with an extra zero term at the start of A010051): A010051, A061007, A035026, A069754, A071574. - Jeremy Gardiner, Aug 09 2002

Let M(n) be the n X n matrix m(i, j) = 0 if n divides ij + 1, m(i, j) = 1 otherwise; then for n > 0 a(n) = -det(M(n)). - Benoit Cloitre, Jan 17 2003

a(m*n) = a(m)*0^(n - 1) + a(n)*0^(m - 1). - Reinhard Zumkeller, Nov 25 2004

a(n) = 1 if n has no divisors other than 1 and n, and 0 otherwise. - Jon Perry, Jul 02 2005

Equals A051731 (the inverse Mobius transform) * A143519. [From Gary W. Adamson, Aug 22 2008]

It appears that a(n) = (H(n)*H(n + 1)) mod n, where H(n) = n!*sum(1/k, k=1..n) = A000254(n) [Gary Detlefs, Sep 12 2010]

a(n) * (2 - n mod 4) = A151763(n). [Reinhard Zumkeller, Oct 06 2011]

REFERENCES

J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 3.

V. Brun, Über das Goldbachsche Gesetz und die Anzahl der Primzahlpaare, Arch. Mat. Natur. B, 34, no. 8, 1915.

Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 65.

J. L. Ramírez, G. N. Rubiano, Properties and Generalizations of the Fibonacci Word Fractal, The Mathematica Journal, Vol. 16 (2014).

LINKS

N. J. A. Sloane and Daniel Forgues, Table of n, a(n) for n = 1..100000 (first 10000 terms from N. J. A. Sloane)

Y. Motohashi, An overview of the Sieve Method and its History

Eric Weisstein's World of Mathematics, Prime Number

Eric Weisstein's World of Mathematics, Prime Constant

Eric Weisstein's World of Mathematics, Prime zeta function primezeta(s).

Index entries for characteristic functions

FORMULA

a(n) = floor(cos(Pi*((n - 1)! + 1)/n)^2) for n >= 2. - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Nov 07 2002

n >= 2, a(n) = floor(phi(n)/(n - 1)) = floor(A000010(n)/(n - 1)). - Benoit Cloitre, Apr 11 2003

a(n) = Sum[d|gcd(n, A034386(n)), moebius(d) ] (Brun).

Dirichlet generating function: primezeta(s). - Franklin T. Adams-Watters, Sep 11 2005.

a(n) = (n - 1)!^2 mod n. - Franz Vrabec, Jun 24 2006

a(n) = A047886(n, 1). - Reinhard Zumkeller, Apr 15 2008

a(n) = A051731((n + 1)! + 1, n) from Wilson's theorem: n is prime if and only if (n + 1)! is congruent to -1 mod n. - N-E. Fahssi, Jan 20 2009, Jan 29 2009

a(n) = A166260/A001477. [From Mats Granvik, Oct 10 2009]

a(n) = 0^A070824, where 0^0=1. [Mats Granvik, Gary W. Adamson, Feb 21 2010]

Dirichlet generating function: log(sum(n >= 1, 1/(A112624(n)*n^s))). [Mats Granvik, Apr 13 2011]

a(n) = A100995(n) - sqrt(A100995(n)*A193056(n)). [Mats Granvik, Jul 15 2011]

(n - 1)*a(n) = ( (2n + 1)!! *sum(1/(2*k + 1), k = 1 .. n) ) mod n, n > 2. [Gary Detlefs, Oct 07 2011]

For n > 1, a(n) = floor(1/A001222(n)): Enrique Pérez Herrero, Feb 23 2012.

a(n) = mu(n) * sum(d|n, mu(d)*omega(d)), where mu is A008683 and omega A001222 or A001221 indistinctly. - Enrique Pérez Herrero, Jun 06 2012

a(n) = A003418(n+1)/A003418(n) - A217863(n+1)/A217863(n) = A014963(n) - A072211(n). - Eric Desbiaux, Nov 25 2012

For n > 1, a(n) = floor(A014963(n)/n). - Eric Desbiaux, Jan 08 2013.

MAPLE

a := n->if isprime(n) then 1 else 0; fi;

MATHEMATICA

Table[ If[ PrimeQ[n], 1, 0], {n, 105}] (* Robert G. Wilson v Jan 15 2005 *)

Table[Boole[PrimeQ[n]], {n, 105}] (* Alonso del Arte, Aug 09 2011 *)

PROG

(MAGMA) s:=[]; for n in [1..100] do if IsPrime(n) then s:=Append(s, 1); else s:=Append(s, 0); end if; end for; s;

(MAGMA) [IsPrime(n) select 1 else 0: n in [1..100]];  // Bruno Berselli, Mar 02 2011

(PARI) { for (n=1, 20000, if (isprime(n), a=1, a=0); write("b010051.txt", n, " ", a); ) } [Harry J. Smith, Jun 15 2009]

(PARI) a(n)=isprime(n) \\ Charles R Greathouse IV, Apr 16, 2011

(Haskell)

import Data.List (unfoldr)

a010051 :: Integer -> Int

a010051 n = a010051_list !! (fromInteger n-1)

a010051_list = unfoldr ch (1, a000040_list) where

   ch (i, ps'@(p:ps)) = Just (fromEnum (i == p),

                              (i + 1, if i == p then ps else ps'))

-- Reinhard Zumkeller, Apr 17 2012, Sep 15 2011

CROSSREFS

Cf. A051006 (constant 0.4146825... (base 10) = 0.01101010001010001010... (base 2)), A001221 (inverse Moebius transform), A143519, A156660, A156659, A156657, A059500, A053176, A059456, A072762.

First differences of A000720, so A000720 gives partial sums.

Sequence in context: A118247 A122257 A129950 * A131929 A100821 A139689

Adjacent sequences:  A010048 A010049 A010050 * A010052 A010053 A010054

KEYWORD

nonn,easy

AUTHOR

N. J. A. Sloane.

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified October 21 03:30 EDT 2014. Contains 248371 sequences.