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.
%I A010051 #328 Aug 22 2025 09:41:05 %S A010051 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, %T A010051 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, %U A010051 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 %N A010051 Characteristic function of primes: 1 if n is prime, else 0. %C A010051 The following sequences all have the same parity (with an extra zero term at the start of a(n)): a(n), A061007, A035026, A069754, A071574. - _Jeremy Gardiner_, Aug 09 2002 %C A010051 Hardy and Wright prove that the real number 0.011010100010... is irrational. See Nasehpour link. - _Michel Marcus_, Jun 21 2018 %C A010051 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 %D A010051 J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 3. %D A010051 V. Brun, Über das Goldbachsche Gesetz und die Anzahl der Primzahlpaare, Arch. Mat. Natur. B, 34, no. 8, 1915. %D A010051 G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, Oxford University Press, London, 1975. %D A010051 Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 65. %D A010051 Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See p. 132. %H A010051 Daniel Forgues, <a href="/A010051/b010051.txt">Table of n, a(n) for n = 1..100000</a> (first 10000 terms from N. J. A. Sloane) %H A010051 Andres Cicuttin, <a href="/A010051/a010051.png">Fourier spectrum of the first 2^20 terms of the characteristic function of primes</a>. %H A010051 William Craig, Jan-Willem van Ittersum and Ken Ono, <a href="https://www.pnas.org/doi/10.1073/pnas.2409417121">Integer partitions detect the primes</a>, PNAS, Vol. 121, No. 39 (2024), e2409417121. %H A010051 Yoichi Motohashi, <a href="https://arxiv.org/abs/math/0505521">An overview of the Sieve Method and its History</a>, arXiv:math/0505521 [math.NT], 2005-2006. %H A010051 Peyman Nasehpour, <a href="https://jac.ut.ac.ir/article_76471.html">A Computational Criterion for the Irrationality of Some Real Numbers</a>, Journal of Algorithms and Computation, Vol. 52, No. 1 (2020), pp. 97-104, <a href="https://arxiv.org/abs/1806.07560">preprint</a>, arXiv:1806.07560 [math.AC], 2018. %H A010051 José L. Ramírez and Gustavo N. Rubiano, <a href="http://www.mathematica-journal.com/2014/02/properties-and-generalizations-of-the-fibonacci-word-fractal/">Properties and Generalizations of the Fibonacci Word Fractal</a>, The Mathematica Journal, Vol. 16 (2014). %H A010051 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PrimeNumber.html">Prime Number</a>. %H A010051 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PrimeConstant.html">Prime Constant</a>. %H A010051 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PrimeZetaFunction.html">Prime zeta function primezeta(s)</a>. %H A010051 <a href="/index/Ch#char_fns">Index entries for characteristic functions</a> %F A010051 a(n) = floor(cos(Pi*((n-1)! + 1)/n)^2) for n >= 2. - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Nov 07 2002 %F A010051 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 %F A010051 n >= 2, a(n) = floor(phi(n)/(n - 1)) = floor(A000010(n)/(n - 1)). - _Benoit Cloitre_, Apr 11 2003 %F A010051 a(n) = Sum_{d|gcd(n, A034386(n))} mu(d). [Brun] %F A010051 a(m*n) = a(m)*0^(n - 1) + a(n)*0^(m - 1). - _Reinhard Zumkeller_, Nov 25 2004 %F A010051 a(n) = 1 if n has no divisors other than 1 and n, and 0 otherwise. - _Jon Perry_, Jul 02 2005 %F A010051 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 %F A010051 a(n) = (n-1)!^2 mod n. - _Franz Vrabec_, Jun 24 2006 %F A010051 a(n) = A047886(n, 1). - _Reinhard Zumkeller_, Apr 15 2008 %F A010051 Equals A051731 (the inverse Möbius transform) * A143519. - _Gary W. Adamson_, Aug 22 2008 %F A010051 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 %F A010051 a(n) = A166260/A001477. - _Mats Granvik_, Oct 10 2009 %F A010051 a(n) = 0^A070824, where 0^0=1. - _Mats Granvik_, _Gary W. Adamson_, Feb 21 2010 %F A010051 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 %F A010051 Dirichlet generating function: log( Sum_{n >= 1} 1/(A112624(n)*n^s) ). - _Mats Granvik_, Apr 13 2011 %F A010051 a(n) = A100995(n) - sqrt(A100995(n)*A193056(n)). - _Mats Granvik_, Jul 15 2011 %F A010051 a(n) * (2 - n mod 4) = A151763(n). - _Reinhard Zumkeller_, Oct 06 2011 %F A010051 (n - 1)*a(n) = ( (2*n + 1)!! * Sum_{k=1..n}(1/(2*k + 1))) mod n, n > 2. - _Gary Detlefs_, Oct 07 2011 %F A010051 For n > 1, a(n) = floor(1/A001222(n)). - _Enrique Pérez Herrero_, Feb 23 2012 %F A010051 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 %F A010051 a(n) = A003418(n+1)/A003418(n) - A217863(n+1)/A217863(n) = A014963(n) - A072211(n). - _Eric Desbiaux_, Nov 25 2012 %F A010051 For n > 1, a(n) = floor(A014963(n)/n). - _Eric Desbiaux_, Jan 08 2013 %F A010051 a(n) = ((abs(n-2))! mod n) mod 2. - _Timothy Hopper_, May 25 2015 %F A010051 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 %F A010051 For n > 4, a(n) = (n-2)! mod n. - _Thomas Ordowski_, Jul 24 2016 %F A010051 From _Ilya Gutkovskiy_, Jul 24 2016: (Start) %F A010051 G.f.: A(x) = Sum_{n>=1} x^A000040(n) = B(x)*(1 - x), where B(x) is the g.f. for A000720. %F A010051 a(n) = floor(2/A000005(n)), for n>1. (End) %F A010051 a(n) = pi(n) - pi(n-1) = A000720(n) - A000720(n-1), for n>=1. - _G. C. Greubel_, Jan 05 2017 %F A010051 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 %F A010051 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 %F A010051 a(n) = Sum_{d|n} mu(d)*omega(n/d), where mu = A008683 and omega = A001221. - _Ridouane Oudra_, Apr 12 2025 %F A010051 a(n) = 0 if (n^2 - 3*n + 2) * A000203(n) - 8 * A002127(n) > 0 else 1 (n>2, see Craig link). - _Bill McEachen_, Jul 04 2025 %p A010051 A010051:= n -> if isprime(n) then 1 else 0 fi; %t A010051 Table[ If[ PrimeQ[n], 1, 0], {n, 105}] (* _Robert G. Wilson v_, Jan 15 2005 *) %t A010051 Table[Boole[PrimeQ[n]], {n, 105}] (* _Alonso del Arte_, Aug 09 2011 *) %t A010051 Table[PrimePi[n] - PrimePi[n-1], {n,50}] (* _G. C. Greubel_, Jan 05 2017 *) %o A010051 (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; %o A010051 (Magma) [IsPrime(n) select 1 else 0: n in [1..100]]; // _Bruno Berselli_, Mar 02 2011 %o A010051 (PARI) a(n)=isprime(n) \\ _Charles R Greathouse IV_, Apr 16 2011 %o A010051 (Haskell) %o A010051 import Data.List (unfoldr) %o A010051 a010051 :: Integer -> Int %o A010051 a010051 n = a010051_list !! (fromInteger n-1) %o A010051 a010051_list = unfoldr ch (1, a000040_list) where %o A010051 ch (i, ps'@(p:ps)) = Just (fromEnum (i == p), %o A010051 (i + 1, if i == p then ps else ps')) %o A010051 -- _Reinhard Zumkeller_, Apr 17 2012, Sep 15 2011 %o A010051 (Python) %o A010051 from sympy import isprime %o A010051 def A010051(n): return int(isprime(n)) # _Chai Wah Wu_, Jan 20 2022 %Y A010051 Cf. A051006 (constant 0.4146825... (base 10) = 0.01101010001010001010... (base 2)), A001221 (inverse Moebius transform), A143519, A156660, A156659, A156657, A059500, A053176, A059456, A072762. %Y A010051 First differences of A000720, so A000720 gives partial sums. %Y A010051 Column k=1 of A117278. %Y A010051 Characteristic function of A000040. %Y A010051 Cf. A008683. %K A010051 nonn,easy,changed %O A010051 1,1 %A A010051 _N. J. A. Sloane_