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.

Showing 1-10 of 22 results. Next

A007350 Where the prime race 4k-1 vs. 4k+1 changes leader.

Original entry on oeis.org

3, 26861, 26879, 616841, 617039, 617269, 617471, 617521, 617587, 617689, 617723, 622813, 623387, 623401, 623851, 623933, 624031, 624097, 624191, 624241, 624259, 626929, 626963, 627353, 627391, 627449, 627511, 627733, 627919, 628013, 628427, 628937, 629371
Offset: 1

Views

Author

Keywords

Comments

The following references include some on the "prime race" question that are not necessarily related to this particular sequence. - N. J. A. Sloane, May 22 2006
Starting from a(12502) = A051025(27556) = 9103362505801, the sequence includes the 8th sign-changing zone predicted by C. Bays et al. The sequence with the first 8 sign-changing zones contains 194367 terms (see a-file) with a(194367) = 9543313015387 as its last term. - Sergei D. Shchebetov, Oct 13 2017

References

  • Ford, Kevin; Konyagin, Sergei; Chebyshev's conjecture and the prime number race. IV International Conference "Modern Problems of Number Theory and its Applications": Current Problems, Part II (Russian) (Tula, 2001), 67-91.
  • Granville, Andrew; Martin, Greg; Prime number races. (Spanish) With appendices by Giuliana Davidoff and Michael Guy. Gac. R. Soc. Mat. Esp. 8 (2005), no. 1, 197-240.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A156749 [sequence showing Chebyshev bias in prime races (mod 4)]. - Daniel Forgues, Mar 26 2009

Programs

  • Mathematica
    lim = 10^5; k1 = 0; k3 = 0; t = Table[{p = Prime[k], If[Mod[p, 4] == 1, ++k1, k1], If[Mod[p, 4] == 3, ++k3, k3]}, {k, 2, lim}]; A007350 = {3}; Do[ If[t[[k-1, 2]] < t[[k-1, 3]] && t[[k, 2]] == t[[k, 3]] && t[[k+1, 2]] > t[[k+1, 3]] || t[[k-1, 2]] > t[[k-1, 3]] && t[[k, 2]] == t[[k, 3]] && t[[k+1, 2]] < t[[k+1, 3]], AppendTo[A007350, t[[k+1, 1]]]], {k, 2, Length[t]-1}]; A007350 (* Jean-François Alcover, Sep 07 2011 *)
    lim = 10^5; k1 = 0; k3 = 0; p = 2; t = {}; parity = Mod[p, 4]; Do[p = NextPrime[p]; If[Mod[p, 4] == 1, k1++, k3++]; If[(k1 - k3)*(parity - Mod[p, 4]) > 0, AppendTo[t, p]; parity = Mod[p, 4]], {lim}]; t (* T. D. Noe, Sep 07 2011 *)

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

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Keywords

Comments

a(n) < 0 for infinitely many values of n. - Benoit Cloitre, Jun 24 2002
First negative value is a(2946) = -1, which is for prime 26861. - David W. Wilson, Sep 27 2002

References

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

Crossrefs

Cf. A112632 (race of 3k-1 and 3k+1 primes), A216057, A269364.
Cf. A156749 (sequence showing Chebyshev bias in prime races (mod 4)), A199547, A267097, A267098, A267107, A292378.
List of primes p such that a(p) = 0 is A007351. List of primes p such that a(p) < 0 is A199547. List of primes p such that a(p) = -1 is A051025. List of integers k such that a(prime(k)) = -1 is A051024. - Ya-Ping Lu, Jan 18 2025

Programs

  • Maple
    ans:=[0]; ct:=0; for n from 2 to 2000 do
    p:=ithprime(n); if (p mod 4) = 3 then ct:=ct+1; else ct:=ct-1; fi;
    ans:=[op(ans),ct]; od: ans; # N. J. A. Sloane, Jun 24 2016
  • Mathematica
    FoldList[Plus, 0, Mod[Prime[Range[2,110]], 4] - 2]
    Join[{0},Accumulate[If[Mod[#,4]==3,1,-1]&/@Prime[Range[2,110]]]] (* Harvey P. Dale, Apr 27 2013 *)
  • PARI
    for(n=2,100,print1(sum(i=2,n,(-1)^((prime(i)+1)/2)),","))
    
  • Python
    from sympy import nextprime; a, p = 0, 2; R = [a]
    for _ in range(2,88): p=nextprime(p); a += p%4-2; R.append(a)
    print(*R, sep = ', ')  # Ya-Ping Lu, Jan 18 2025

Formula

a(n) = Sum_{k=2..n} (-1)^((prime(k)+1)/2). - Benoit Cloitre, Jun 24 2002
a(n) = (Sum_{k=1..n} prime(k) mod 4) - 2*n (assuming that x mod 4 > 0). - Thomas Ordowski, Sep 21 2012
From Antti Karttunen, Oct 01 2017: (Start)
a(n) = A267098(n) - A267097(n).
a(n) = A292378(A000040(n)).
(End)
From Ridouane Oudra, Nov 04 2024: (Start)
a(n) = Sum_{k=2..n} i^(prime(k)+1), where i is the imaginary unit.
a(n) = Sum_{k=2..n} sin(3*prime(k)*Pi/2).
a(n) = Sum_{k=2..n} A163805(prime(k)).
a(n) = Sum_{k=2..n} A212159(k). (End)
a(n) = a(n-1) + prime(n) (mod 4) - 2, n >= 2. - Ya-Ping Lu, Jan 18 2025

A007351 Where prime race 4m-1 vs. 4m+1 is tied.

Original entry on oeis.org

2, 5, 17, 41, 461, 26833, 26849, 26863, 26881, 26893, 26921, 616769, 616793, 616829, 616843, 616871, 617027, 617257, 617363, 617387, 617411, 617447, 617467, 617473, 617509, 617531, 617579, 617681, 617707, 617719, 618437, 618521, 618593, 618637
Offset: 1

Views

Author

Keywords

Comments

Primes p such that the number of primes <= p of the form 4m-1 is equal to the number of primes <= p of the form 4m+1.
Starting from a(27410)=9103362505753 the sequence includes the 8th sign-changing zone predicted by C. Bays et al. The sequence with the first 8 sign-changing zones contains 419467 terms (see a-file) with a(419467)=9543313015351 as its last term. - Sergei D. Shchebetov, Oct 15 2017

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A156749 Sequence showing Chebyshev bias in prime races (mod 4). [From Daniel Forgues, Mar 26 2009]

Programs

  • Mathematica
    Prime@ Position[Fold[Append[#1, #1[[-1]] + If[Mod[#2, 4] == 3, {1, 0}, {0, 1}]] &, {{0, 0}}, Prime@ Range[2, 10^5]], ?(SameQ @@ # &)][[All, 1]] (* _Michael De Vlieger, May 27 2018 *)
  • PARI
    lista(nn) = {nb = 0; forprime(p=2, nn, m = (p % 4); if (m == 1, nb++, if (m == 3, nb--)); if (!nb, print1(p, ", ")););} \\ Michel Marcus, Oct 05 2017
    
  • Python
    from sympy import nextprime; a, p = 0, 2; R = [p]
    while p < 618637:
        p=nextprime(p); a += p%4-2
        if a == 0: R.append(p)
    print(*R, sep = ', ')  # Ya-Ping Lu, Jan 18 2025

Extensions

Corrected and extended by Enoch Haga, Feb 24 2004

A051024 Values of n for which pi_{4,3}(p_n) - pi_{4,1}(p_n) = -1, where p_n is the n-th prime and pi_{m,a}(x) is the number of primes <= x which are congruent to a (mod m).

Original entry on oeis.org

2946, 50378, 50380, 50382, 50392, 50414, 50418, 50420, 50422, 50424, 50426, 50428, 50430, 50436, 50438, 50446, 50448, 50450, 50822, 50832, 50834, 50842, 50844, 50852, 50854, 50856, 50858, 50862, 50864, 50866, 50872, 50892, 50902
Offset: 1

Views

Author

Keywords

Comments

This is a companion sequence to A051025.
Starting from a(27556) = 316064952540 the sequence includes the 8th sign-changing zone predicted by C. Bays et al. The sequence with the first 8 sign-changing zones contains 418933 terms (see a-file) with a(418933) = 330797040308 as its last term. - Sergei D. Shchebetov, Oct 06 2017
We also discovered the 9th sign-changing zone, which starts from 2083576475506, ends with 2083615410040, and has 13370 terms with pi_{4,3}(p) - pi_{4,1}(p) = -1. This zone is considerably lower than predicted by M. Deléglise et al. in 2004. - Andrey S. Shchebetov and Sergei D. Shchebetov, Dec 30 2017
We also discovered the 10th sign-changing zone, which starts from 21576098946648, ends with 22056324317296, and has 481194 terms with pi_{4,3}(p) - pi_{4,1}(p) = -1. This zone is considerably lower than predicted by M. Deléglise et al. in 2004. - Andrey S. Shchebetov and Sergei D. Shchebetov, Jan 28 2018

Crossrefs

Cf. A156749 (Sequence showing Chebyshev bias in prime races (mod 4)). - Daniel Forgues, Mar 26 2009

Programs

  • Mathematica
    For[i=2; d=0, True, i++, d+=Mod[Prime[i], 4]-2; If[d==-1, Print[i]]]
    (* Second program: *)
    Position[Accumulate@ Array[Mod[Prime@ #, 4] - 2 &, 51000], -1][[All, 1]] (* Michael De Vlieger, Dec 30 2017 *)
  • Python
    from sympy import nextprime; a, p = 0, 2
    for n in range(2, 50917):
        p=nextprime(p); a += p%4-2
        if a == -1: print(n, end = ', ') # Ya-Ping Lu, Jan 18 2025

Extensions

Edited by Dean Hickerson, Mar 05 2002

A096628 Integers k for which {prime(1), prime(2), ..., prime(k)} (mod 4) is biased towards 1.

Original entry on oeis.org

2946, 50378, 50380, 50382, 50383, 50384, 50385, 50386, 50387, 50388, 50389, 50390, 50391, 50392, 50414, 50415, 50416, 50417, 50418, 50419, 50420, 50421, 50422, 50424, 50426, 50428, 50430, 50436, 50438, 50446, 50447, 50448, 50450
Offset: 1

Views

Author

Eric W. Weisstein, Jul 01 2004

Keywords

Comments

Indices of negative terms in A038698. - Jianing Song, Feb 20 2019

Crossrefs

Programs

  • Maple
    R:= NULL: count:= 0: v:= 0: p:= 2:
    for i from 2 while count < 100 do
      p:= nextprime(p);
      if p mod 4 = 3 then v:= v+1
      else v:= v-1
      fi;
      if v < 0 then R:= R,i; count:= count+1 fi
    od:
    R; # Robert Israel, Apr 17 2023

A199547 Primes p for which pi_{4,3}(p) < pi_{4,1}(p), where pi_{m,a}(x) is the number of primes <= x which are congruent to a (mod m).

Original entry on oeis.org

26861, 616841, 616849, 616877, 616897, 616909, 616933, 616943, 616951, 616961, 616991, 616997, 616999, 617011, 617269, 617273, 617293, 617311, 617327, 617333, 617339, 617341, 617359, 617369, 617401, 617429, 617453, 617521, 617537, 617689, 617693, 617699, 617717
Offset: 1

Views

Author

Arkadiusz Wesolowski, Dec 09 2011

Keywords

Comments

Another version of A007350.
J. E. Littlewood (1914) proved that this sequence is infinite.
a(1) = 26861 was found in 1957 by John Leech.
Prime indices of negative terms in A066520. - Jianing Song, Feb 20 2019

References

  • Wacław Sierpiński, O stu prostych, ale trudnych zagadnieniach arytmetyki. Warsaw: PZWS, 1959, p. 22.

Crossrefs

Programs

  • Mathematica
    lst = {}; For[n = 2; t = 0, n < 50451, n++, t += Mod[p = Prime[n], 4] - 2; If[t < 0, AppendTo[lst, p]]]; lst
  • Python
    from sympy import nextprime; a, p = 0, 2
    while p < 617717:
        p=nextprime(p); a += p%4-2
        if a < 0: print(p, end = ', ') # Ya-Ping Lu, Jan 18 2025

Formula

a(n) = prime(A096628(n)). - Jianing Song, Feb 20 2019

A051025 Primes p for which pi_{4,3}(p) - pi_{4,1}(p) = -1, where pi_{m,a}(x) is the number of primes <= x which are congruent to a (mod m).

Original entry on oeis.org

26861, 616841, 616849, 616877, 617011, 617269, 617327, 617339, 617359, 617369, 617401, 617429, 617453, 617521, 617537, 617689, 617699, 617717, 622813, 622987, 623003, 623107, 623209, 623299, 623321, 623341, 623353, 623401, 623423, 623437
Offset: 1

Views

Author

Keywords

Comments

This is a companion sequence to A051024.
Starting from a(27556)=9103362505801 the sequence includes the 8th sign-changing zone predicted by C. Bays et al. The sequence with the first 8 sign-changing zones contains 418933 terms (see a-file) with a(418933)=9543313015309 as its last term. - Sergei D. Shchebetov, Oct 06 2017
We also discovered the 9th sign-changing zone, which starts from 64083080712569, ends with 64084318523021, and has 13370 terms with pi_{4,3}(p) - pi_{4,1}(p) = -1. This zone is considerably lower than predicted by M. Deléglise et al. in 2004. - Andrey S. Shchebetov and Sergei D. Shchebetov, Dec 30 2017
We also discovered the 10th sign-changing zone, which starts from 715725135905981, ends with 732156384107921, and has 481194 terms with pi_{4,3}(p) - pi_{4,1}(p) = -1. This zone is considerably lower than predicted by M. Deléglise et al. in 2004. - Andrey S. Shchebetov and Sergei D. Shchebetov, Jan 28 2018

Crossrefs

Cf. A156749 Sequence showing Chebyshev bias in prime races (mod 4). - Daniel Forgues, Mar 26 2009

Programs

  • Mathematica
    For[i=2; d=0, True, i++, d+=Mod[p=Prime[i], 4]-2; If[d==-1, Print[p]]]
    (* Second program: *)
    Prime@ Position[Accumulate@ Array[Mod[Prime@ #, 4] - 2 &, 51000], -1][[All, 1]] (* Michael De Vlieger, Dec 30 2017 *)
  • Python
    from sympy import nextprime; a, p = 0, 2
    while p < 623803:
        p=nextprime(p); a += p%4-2
        if a == -1: print(p, end = ', ')  # Ya-Ping Lu, Jan 18 2025

Extensions

Edited by Dean Hickerson, Mar 10 2002

A156749 For all numbers k(n) congruent to -1 or +1 (mod 4) starting with k(n) = {3,5,7,9,11,...}, a(k(n)) is incremented by the congruence (mod 4) if k(n) is prime and by 0 if k(n) is composite.

Original entry on oeis.org

-1, 0, -1, -1, -2, -1, -1, 0, -1, -1, -2, -2, -2, -1, -2, -2, -2, -1, -1, 0, -1, -1, -2, -2, -2, -1, -1, -1, -2, -1, -1, -1, -2, -2, -3, -2, -2, -2, -3, -3, -4, -4, -4, -3, -3, -3, -3, -2, -2, -1, -2, -2, -3, -2, -2, -1, -1, -1, -1, -1, -1, -1, -2, -2, -3, -3, -3, -2, -3, -3
Offset: 1

Views

Author

Daniel Forgues, Feb 14 2009

Keywords

Comments

The fact that a(k(n)) is predominantly negative exhibits the Chebyshev Bias (where the congruences that are not quadratic residues generally lead in the prime number races, at least for "small" integers, over the congruences that are quadratic residues).
This bias seems caused (among other causes?) by the presence of all those squares (even powers) coprime to 4 taking away opportunities for primes to appear in the quadratic residue class +1 (mod 4), while the non-quadratic residue class -1 (mod 4) is squarefree.
The density of squares congruent to +1 (mod 4) is 1/(4*sqrt(k(n))) since 1/2 of squares are congruent to +1 (mod 4), while the density of primes in either residue class -1 or +1 (mod 4) is 1/(phi(4)*log(k(n))), with phi(4) = 2.
Here 1 is quadratic residue mod 4, but 3 (or equivalently -1) is quadratic non-residue mod 4. All the even powers (included in the squares) map congruences {-1, +1} to {+1, +1} respectively and so contribute to the bias, whereas all the odd powers map {-1, +1} to {-1, +1} respectively and so do not contribute to the bias.
One would then expect the ratio of this bias, if caused exclusively by the even powers, relative to the number of primes in either congruences to asymptotically tend towards to 0 as k(n) increases (since 1/(4*sqrt(k(n))) is o(1/(phi(4)*log(k(n))))).
The persistence or not of such bias in absolute value then does not contradict The Prime Number Theorem for Arithmetic Progressions (Dirichlet) which states that the asymptotic (relative) ratio of the count of prime numbers in each congruence class coprime to m tends to 1 in the limit towards infinity. (Cf. 'Prime Number Races' link below.)
Also, even if this bias grows in absolute value, it is expected to be drowned out (albeit very slowly) by the increasing fluctuations in the number of primes in each congruence class coprime to 4 since, assuming the truth of the Riemann Hypothesis, their maximum amplitude would be, with x standing for k(n) in our case, h(x) = O(sqrt(x)*log(x)) <= C*sqrt(x)*log(x) in absolute value which gives relative fluctuations of order h(x)/x = O(log(x)/sqrt(x)) <= C*log(x)/sqrt(x) in the densities of primes pi(x, {4, 1})/x and pi(x, {4, 3})/x in either congruence class.
Since 1/(4*sqrt(x)) is o(log(x)/sqrt(x)) the bias will eventually be overwhelmed by the "pink noise or nearly 1/f noise" corresponding to the fluctuations in the prime densities in either congruence class. The falsehood of the Riemann Hypothesis would imply even greater fluctuations since the RH corresponds to the minimal h(x).
We get pink noise or nearly 1/f noise if we consider the prime density fluctuations of pi(x, {4, k})/x as an amplitude spectrum over x (with a power density spectrum of (C*log(x)/sqrt(x))^2 = ((C*log(x))^2)/x and see x as the frequency f. This power density spectrum is then nearly 1/x and would have nearly equal energy (although slowly increasing as (C*log(x))^2) for each octave of x. (Cf. 'Prime Numbers: A Computational Perspective' link below.)
Among the positive integers k(n) up to 100000 that are congruent to -1 or +1 (mod 4) [indexed from n = 1 to 49999, with k(n) = 4*ceiling(n/2) + (-1)^n], a tie is attained or maintained, with a(k(n)) = 0, for only 34 integers and that bias favoring the non-quadratic residue class -1 (mod 4) gets violated only once, i.e., a(k(n)) = +1, for index n = 13430 (corresponding to the prime k(n) = 26861 congruent to +1 (mod 4) since n is even) where the congruence +1 leads once!

References

  • Richard E. Crandall and Carl Pomerance, Prime Numbers: A Computational Perspective

Crossrefs

Programs

  • Mathematica
    Table[Which[!PrimeQ[2*n+1], 0, Mod[2*n+1, 4] == 1, 1, True, -1], {n, 1, 100}] // Accumulate (* Jean-François Alcover, Dec 09 2014 *)

Formula

a(n) = -A066520(2*n+1) = A066339(2*n+1) - A066490(2*n+1). - Jonathan Sondow, May 17 2013

Extensions

Edited by Daniel Forgues, Mar 01 2009, Mar 29 2009

A297447 Values of n for which pi_{8,5}(p_n) - pi_{8,1}(p_n) = -1, where p_n is the n-th prime and pi_{m,a}(x) is the number of primes <= x which are congruent to a (mod m).

Original entry on oeis.org

30733704, 30733708, 30733714, 30733726, 30733729, 30733733, 30733743, 30733762, 30733764, 30733777, 30733781, 30733796, 30733853, 30733857, 30733860, 30733866, 30733880, 30733887, 30733890, 30734262
Offset: 1

Views

Author

Andrey S. Shchebetov and Sergei D. Shchebetov, Dec 30 2017

Keywords

Comments

This is a companion sequence to A297448. The first two sign-changing zones were discovered by Bays and Hudson back in 1979. We discovered four additional zones starting from a(22794) = 186422420112. The full sequence with all 6 zones checked up to 5*10^14 contains 664175 terms (see a-file) with a(664175) = 6097827689926 as its last term.
This sequence was checked up to 10^15 and the 7th sign-changing zone starting from a(664176) = 27830993289634 and ending with a(850232)= 27876113171315 was found. - Andrey S. Shchebetov and Sergei D. Shchebetov, Jul 28 2018
The y-coordinate of prime(a(n)) on the Cartesian grid defined in A379643 is -1. - Ya-Ping Lu, Jan 08 2025

Crossrefs

Programs

  • Python
    from sympy import nextprime; p, r1, r5 = 1, 0, 0
    for n in range(1, 30734263):
        p = nextprime(p); r = p%8
        if r == 1: r1 += 1
        elif r == 5: r5 += 1
    if r in {1, 5} and r1 == r5 + 1: print(n, end = ', ')  # Ya-Ping Lu, Jan 08 2025

A295354 Primes p for which pi_{8,7}(p) - pi_{8,1}(p) = -1, where pi_{m,a}(x) is the number of primes <= x which are congruent to a (mod m).

Original entry on oeis.org

192252423729713, 192252423730849, 192252423731231, 192252423731633, 192252423731663, 192252423731839, 192252423732311, 192252423769201, 192252423769361, 192252423769537, 192252423772649, 192252423772807, 192252423772847, 192252423774023, 192252423774079, 192252423774457, 192252423779257, 192252423782521, 192252423783263, 192252423783551
Offset: 1

Views

Author

Andrey S. Shchebetov and Sergei D. Shchebetov, Nov 20 2017

Keywords

Comments

This sequence is a companion sequence to A295353. The sequence with the first found pi_{8,7}(p_n) - pi_{8,1}(p_n) sign-changing zone contains 234937 terms (see a-file) with a(237937) = 192876135747311 as its last term. In addition, a(1) = A275939(8).

Crossrefs

Showing 1-10 of 22 results. Next