

A130911


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


5



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, 7, 8, 9, 8, 9, 10, 11, 12, 13, 14, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 21, 20, 19, 20, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,6


COMMENTS

Prime race between evil primes (A027699) and odious primes (A027697).
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.
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


LINKS

T. D. Noe, Table of n, a(n) for n=1..10000
CNRS Press release, The sum of digits of prime numbers is evenly distributed, May 12, 2010.
Christian Mauduit and Joël Rivat, Sur un problème de Gelfond: la somme des chiffres des nombres premiers, Annals Math., 171 (2010), 15911646.
ScienceDaily, Sum of Digits of Prime Numbers Is Evenly Distributed: New Mathematical Proof of Hypothesis, May 12, 2010.
Vladimir Shevelev, A conjecture on primes and a step towards justification, arXiv:0706.0786 [math.NT], 2007.
Vladimir Shevelev, On excess of odious primes, arXiv:0707.1761 [math.NT], 2007.


FORMULA

a(n) = (number of odious primes <= prime(n))  (number of evil primes <= prime(n)).
a(n) = A200247(n)  A200246(n).


MATHEMATICA

cnt=0; Table[p=Prime[n]; If[EvenQ[Count[IntegerDigits[p, 2], 1]], cnt, cnt++ ]; cnt, {n, 10000}]
Accumulate[If[OddQ[DigitCount[#, 2, 1]], 1, 1]&/@Prime[Range[100]]] (* Harvey P. Dale, Aug 09 2013 *)


PROG

(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=nOnE; print1(an, ", ")) \\ Washington Bomfim, Jan 14 2011


CROSSREFS

Cf. A095005, A095006.
Cf. A199399, A027697, A027698, A027699, A027700, A200244, A200245, A200246, A200247.
Cf. A156549 (race between primes having an odd/even number of zeros in binary).
Sequence in context: A035224 A272677 A165579 * A319300 A118829 A118832
Adjacent sequences: A130908 A130909 A130910 * A130912 A130913 A130914


KEYWORD

nice,sign,base


AUTHOR

T. D. Noe, Jun 08 2007


EXTENSIONS

Edited by N. J. A. Sloane, Nov 16 2011


STATUS

approved



