login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A038698 Excess of 4k-1 primes over 4k+1 primes, beginning with prime 2. 28

%I #65 Nov 05 2023 11:35:26

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

%T 2,3,2,3,4,3,4,3,4,3,2,3,4,5,6,5,4,5,4,5,4,5,4,5,4,3,4,3,4,5,4,3,4,3,

%U 4,3,2,3,4,3,4,5,4,3,2,1,2,1,2,1,2,3,2,1,0,1,2,3,4,5,6,7,6,5,6,5,6,5,6,5,6

%N Excess of 4k-1 primes over 4k+1 primes, beginning with prime 2.

%C a(n) < 0 for infinitely many values of n. - _Benoit Cloitre_, Jun 24 2002

%C First negative value is a(2946) = -1, which is for prime 26861. - _David W. Wilson_, Sep 27 2002

%D Stan Wagon, The Power of Visualization, Front Range Press, 1994, p. 2.

%H N. J. A. Sloane, <a href="/A038698/b038698.txt">Table of n, a(n) for n = 1..20000</a> (first 10000 terms from T. D. Noe)

%F a(n) = Sum_{k=2..n} (-1)^((prime(k)+1)/2). - _Benoit Cloitre_, Jun 24 2002

%F a(n) = (Sum_{k=1..n} prime(k) mod 4) - 2*n (assuming that x mod 4 > 0). - _Thomas Ordowski_, Sep 21 2012

%F From _Antti Karttunen_, Oct 01 2017: (Start)

%F a(n) = A267098(n) - A267097(n).

%F a(n) = A292378(A000040(n)).

%F (End)

%p ans:=[0]; ct:=0; for n from 2 to 2000 do

%p p:=ithprime(n); if (p mod 4) = 3 then ct:=ct+1; else ct:=ct-1; fi;

%p ans:=[op(ans),ct]; od: ans; # _N. J. A. Sloane_, Jun 24 2016

%t FoldList[Plus, 0, Mod[Prime[Range[2,110]], 4] - 2]

%t Join[{0},Accumulate[If[Mod[#,4]==3,1,-1]&/@Prime[Range[2,110]]]] (* _Harvey P. Dale_, Apr 27 2013 *)

%o (PARI) for(n=2,100,print1(sum(i=2,n,(-1)^((prime(i)+1)/2)),","))

%Y Cf. A007350, A007351, A038691, A051024, A066520.

%Y Cf. A112632 (race of 3k-1 and 3k+1 primes), A216057, A269364.

%Y Cf. A156749 (sequence showing Chebyshev bias in prime races (mod 4)), A199547, A267097, A267098, A267107, A292378.

%K sign,easy,nice,hear

%O 1,5

%A _Hans Havermann_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 18 22:56 EDT 2024. Contains 370952 sequences. (Running on oeis4.)