login
a(n) = number of primes with an even digit sum among the first n primes minus the number with an odd digit sum.
1

%I #27 Aug 03 2014 14:37:24

%S 1,0,-1,-2,-1,0,1,2,1,0,1,2,1,0,-1,0,1,0,-1,0,1,2,1,0,1,2,3,4,5,4,5,4,

%T 3,2,3,2,1,2,3,2,1,2,1,0,-1,-2,-1,-2,-3,-4,-3,-2,-3,-2,-1,-2,-3,-2,-1,

%U -2,-3,-2,-1,-2,-3,-4,-5,-6,-5,-4,-5,-6,-5,-6

%N a(n) = number of primes with an even digit sum among the first n primes minus the number with an odd digit sum.

%H T. D. Noe, <a href="/A199339/b199339.txt">Table of n, a(n) for n = 1..10000</a>

%H 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 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 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.

%F a(n)=sum_{k=1...n} (-1)^A007605(n).

%F Equals A200262 - A200264.

%e a(1)=1 because the first prime has an even sum of digits.

%e a(2)=0, a(3)=-1, a(4)=-2 because the following primes (3,5,7) have odd sum of digits.

%e a(5)=-1, a(6)=0, a(7)=1, a(8)=2 because the 5th, 6th, 7th and 8th prime (11, 13, 17, 19) have an even sum of digits.

%t a[1] := 1; a[n_] := a[n] = a[n - 1] + (-1)^(Plus@@IntegerDigits[Prime[n]]); Table[a[n], {n, 74}] (* _Alonso del Arte_, Nov 14 2011 *)

%o (PARI) s=0;vector(90,n,s+=(-1)^A007953(prime(n)))

%Y Cf. A007605, A007953, A130911, A200259, A200260, A119449, A119450, A200261, A200262, A200263, A200264.

%K sign,base

%O 1,4

%A _M. F. Hasler_, Nov 14 2011