A010051 - OEIS (original) (raw)

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

COMMENTS

Hardy and Wright prove that the real number 0.011010100010... is irrational. See Nasehpour link. - Michel Marcus, Jun 21 2018

The spectral components (excluding the zero frequency) of the Fourier transform of the partial sequences {a(j)} with j=1..n and n an even number, exhibit a remarkable symmetry with respect to the central frequency component at position 1 + n/4. See the Fourier spectrum of the first 2^20 terms in Links, Comments in A289777, and Conjectures in A001223 of Sep 01 2019. It also appears that the symmetry grows with n. - Andres Cicuttin, Aug 23 2020

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.

G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, Oxford University Press, London, 1975.

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

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

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

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

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))} mu(d). [Brun]

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

Dirichlet generating function: Sum_{n >= 1} a(n)/n^s = primezeta(s), where primezeta is the prime zeta function. - Franklin T. Adams-Watters, Sep 11 2005

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

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

It appears that a(n) = (H(n)*H(n + 1)) mod n, where H(n) = n!*Sum_{k=1..n} 1/k = A000254(n). - Gary Detlefs, Sep 12 2010

Dirichlet generating function: log( Sum_{n >= 1} 1/(A112624(n)*n^s) ). - Mats Granvik, Apr 13 2011

(n - 1)*a(n) = ( (2*n + 1)!! * Sum_{k=1..n}(1/(2*k + 1))) mod n, n > 2. - Gary Detlefs, Oct 07 2011

a(n) = ((abs(n-2))! mod n) mod 2. - Timothy Hopper, May 25 2015

a(n) = abs(F(n)) - abs(F(n)-1/2) - abs(F(n)-1) + abs(f(n)-3/2), where F(n) = Sum_{m=2..n+1} (abs(1 - (n mod m)) - abs(1/2 - (n mod m)) + 1/2), n > 0. F(n) = 1 if n is prime, > 1 otherwise, except F(1) = 0. a(n) = 1 if F(n) = 1, 0 otherwise. - Timothy Hopper, Jun 16 2015

For n > 4, a(n) = (n-2)! mod n. - Thomas Ordowski, Jul 24 2016

G.f.: A(x) = Sum_{n>=1} x^A000040(n) = B(x)*(1 - x), where B(x) is the g.f. for A000720.

a(n) = floor(2/A000005(n)), for n>1. (End)

Decimal expansion of Sum_{k>=1} (1/10)^prime(k) = 9 * Sum_{k>=1} pi(k)/10^(k+1), where pi(k) = A000720(k). - Amiram Eldar, Aug 11 2020

a(n) = 1 - ceiling((2/n) * Sum_{k=2..floor(sqrt(n))} floor(n/k)-floor((n-1)/k)), n>1. - Gary Detlefs, Sep 08 2023

MAPLE

A010051:= 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 *)

Table[PrimePi[n] - PrimePi[n-1], {n, 50}] (* G. C. Greubel, Jan 05 2017 *)

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

(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'))

(Python)

from sympy import isprime

CROSSREFS

First differences of A000720, so A000720 gives partial sums.

Characteristic function of A000040.