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.

A130911 a(n) is the number of primes with odd binary weight among the first n primes minus the number with an even binary weight.

This page as a plain text file.
%I A130911 #29 Dec 22 2021 02:18:24
%S A130911 1,0,-1,0,1,2,1,2,1,0,1,2,3,2,3,2,3,4,5,4,5,6,5,4,5,4,5,6,7,6,7,8,9,8,
%T A130911 7,8,9,8,9,10,11,12,13,14,13,14,15,16,17,18,19,20,21,22,21,20,19,20,
%U A130911 19,18,19,18,19,18,19,18,19,18,17,16,15,14,15,14,15,14,13,14,13,14,15,16,17,18,19,20,19,20,19,20,19,18,19,20,21,20,19
%N A130911 a(n) is the number of primes with odd binary weight among the first n primes minus the number with an even binary weight.
%C A130911 Prime race between evil primes (A027699) and odious primes (A027697).
%C A130911 Shevelev conjectures that a(n) >= 0 for n > 3. Surprisingly, the conjecture also appears to be true if we count zeros instead of ones in the binary representation of prime numbers.
%C A130911 The conjecture is true for primes up to at least 10^13. Mauduit and Rivat prove that half of all primes are evil. - _T. D. Noe_, Feb 09 2009
%H A130911 T. D. Noe, <a href="/A130911/b130911.txt">Table of n, a(n) for n = 1..10000</a>
%H A130911 CNRS Press release, <a href="http://www2.cnrs.fr/en/1732.htm">The sum of digits of prime numbers is evenly distributed</a>, May 12, 2010.
%H A130911 Christian Mauduit and Joël Rivat, <a href="http://annals.math.princeton.edu/2010/171-3/p04">Sur un problème de Gelfond: la somme des chiffres des nombres premiers</a>, Annals Math., 171 (2010), 1591-1646.
%H A130911 ScienceDaily, <a href="http://www.sciencedaily.com/releases/2010/05/100512172533.htm">Sum of Digits of Prime Numbers Is Evenly Distributed: New Mathematical Proof of Hypothesis</a>, May 12, 2010.
%H A130911 Vladimir Shevelev, <a href="https://arxiv.org/abs/0706.0786">A conjecture on primes and a step towards justification</a>, arXiv:0706.0786 [math.NT], 2007.
%H A130911 Vladimir Shevelev, <a href="https://www.arxiv.org/abs/0707.1761">On excess of odious primes</a>, arXiv:0707.1761 [math.NT], 2007.
%F A130911 a(n) = (number of odious primes <= prime(n)) - (number of evil primes <= prime(n)).
%F A130911 a(n) = A200247(n) - A200246(n).
%t A130911 cnt=0; Table[p=Prime[n]; If[EvenQ[Count[IntegerDigits[p,2],1]], cnt--, cnt++ ]; cnt, {n,10000}]
%t A130911 Accumulate[If[OddQ[DigitCount[#,2,1]],1,-1]&/@Prime[Range[100]]] (* _Harvey P. Dale_, Aug 09 2013 *)
%o A130911 (PARI)f(p)={v=binary(p);s=0;for(k=1,#v,if(v[k]==1,s++)); return(s%2)};nO=0;nE=0;forprime(p=2,520,if(f(p),nO++, nE++);an=nO-nE;print1(an,", ")) \\ _Washington Bomfim_, Jan 14 2011
%o A130911 (Python)
%o A130911 from sympy import nextprime
%o A130911 from itertools import islice
%o A130911 def agen():
%o A130911     p, evod = 2, [0, 1]
%o A130911     while True:
%o A130911         yield evod[1] - evod[0]
%o A130911         p = nextprime(p); evod[bin(p).count('1')%2] += 1
%o A130911 print(list(islice(agen(), 97))) # _Michael S. Branicky_, Dec 21 2021
%Y A130911 Cf. A095005, A095006.
%Y A130911 Cf. A199399, A027697, A027698, A027699, A027700, A200244, A200245, A200246, A200247.
%Y A130911 Cf. A156549 (race between primes having an odd/even number of zeros in binary).
%K A130911 nice,sign,base
%O A130911 1,6
%A A130911 _T. D. Noe_, Jun 08 2007
%E A130911 Edited by _N. J. A. Sloane_, Nov 16 2011