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 23 results. Next

A092198 Equal count of primes congruent to 1 mod 4 and 3 mod 4 associated with primes in A007351 (the zero beginning the sequence indicates the prime 2).

Original entry on oeis.org

0, 1, 3, 6, 44, 1471, 1472, 1473, 1474, 1475, 1476, 25185, 25187, 25188, 25189, 25190, 25196, 25206, 25211, 25212, 25213, 25214, 25215, 25216, 25217, 25218, 25219, 25222, 25224, 25225, 25251, 25253, 25257, 25258, 25410, 25421, 25426, 25427
Offset: 1

Views

Author

Enoch Haga, Feb 24 2004

Keywords

Examples

			a(3)=3 because at this point there are 3 primes congruent to 1 mod 4: 5, 13, 17 and 3 primes congruent to 3 mod 4: 3, 7, 11.
		

Crossrefs

Cf. A007351.

Programs

  • Mathematica
    Block[{a = 0, b = -1}, Reap[Do[If[Mod[p, 4] == 1, a++, b++]; If[a == b, Sow@ a, 0], {p, Prime@ Range[51000]}]][[-1, -1]]] (* Michael De Vlieger, Mar 26 2018 *)

Formula

Compute the running totals of primes congruent to 1 mod 4 and primes congruent to 3 mod 4. When these totals are equal, include in the sequence.

Extensions

Typo in data corrected by Sean Reeves, Mar 24 2018

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

A038691 Indices of primes at which the prime race 4k-1 vs. 4k+1 is tied.

Original entry on oeis.org

1, 3, 7, 13, 89, 2943, 2945, 2947, 2949, 2951, 2953, 50371, 50375, 50377, 50379, 50381, 50393, 50413, 50423, 50425, 50427, 50429, 50431, 50433, 50435, 50437, 50439, 50445, 50449, 50451, 50503, 50507, 50515, 50517, 50821, 50843, 50853, 50855, 50857, 50859, 50861
Offset: 1

Views

Author

Keywords

Comments

Starting from a(27410) = 316064952537 the sequence includes the 8th sign-changing zone predicted by C. Bays et al back in 2001. The sequence with the first 8 sign-changing zones contains 419467 terms (see a-file) with a(419467) = 330797040309 as its last term. - Sergei D. Shchebetov, Oct 16 2017

Examples

			From _Jon E. Schoenfield_, Jul 24 2021: (Start)
a(n) is the n-th number m at which the prime race 4k-1 vs. 4k+1 is tied:
.
                             count
                           ----------
   m  p=prime(m)  p mod 4  4k-1  4k+1
  --  ----------  -------  ----  ----
   1       2         2       0  =  0    a(1)=1
   2       3        -1       1     0
   3       5        +1       1  =  1    a(2)=3
   4       7        -1       2     1
   5      11        -1       3     1
   6      13        +1       3     2
   7      17        +1       3  =  3    a(3)=7
   8      19        -1       4     3
   9      23        -1       5     3
  10      29        +1       5     4
  11      31        -1       6     4
  12      37        +1       6     5
  13      41        +1       6  =  6    a(4)=13
(End)
		

References

  • Stan Wagon, The Power of Visualization, Front Range Press, 1994, pp. 2-3.

Crossrefs

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

Programs

  • Mathematica
    Flatten[ Position[ FoldList[ Plus, 0, Mod[ Prime[ Range[ 2, 50900 ] ], 4 ]-2 ], 0 ] ]
  • PARI
    lista(nn) = {nbp = 0; nbm = 0; forprime(p=2, nn, if (((p-1) % 4) == 0, nbp++, if (((p+1) % 4) == 0, nbm++)); if (nbm == nbp, print1(primepi(p), ", ")););} \\ Michel Marcus, Nov 20 2016

A096447 Odd primes p such that the number of primes less than p that are congruent to 1 (mod 4) is equal to the number of primes less than p that are congruent to 3 (mod 4).

Original entry on oeis.org

3, 7, 19, 43, 463, 26839, 26861, 26879, 26891, 26903, 26927, 616783, 616799, 616841, 616849, 616877, 617039, 617269, 617369, 617401, 617429, 617453, 617471, 617479, 617521, 617537, 617587, 617689, 617717, 617723, 618439, 618547, 618619, 618643
Offset: 1

Views

Author

Yasutoshi Kohmoto, Aug 12 2004

Keywords

Comments

Assign the odd prime numbers to the rows of an array as follows:
Assign the first odd prime, prime(2) = 3, to row 0 (the top row).
For m > 2, assign prime(m) to the row immediately above or below the row to which prime(m-1) was assigned: above if prime(m-1) == 1 (mod 4), below otherwise.
The following array results:
row 0 (this sequence): 3, 7, 19, 43, 463, 26839, ...
row 1 (A096448): 5, 11, 17, 23, 31, 41, 47, 59, 67, 103, 127, ...
row 2 (A096451): 13, 29, 37, 53, 61, 71, 79, 101, 107, 113 ...
row 3: 73, 83, 97, 109, ...
row 4: 89, ...

Crossrefs

Programs

  • Mathematica
    lim = 10^5; k1 = 0; k3 = 0; p = 2; t = {}; Do[p = NextPrime[p]; If[k1 == k3, AppendTo[t, p]]; If[Mod[p, 4] == 1, k1++, k3++], {lim}]; t (* T. D. Noe, Sep 07 2011 *)

Formula

a(n) = A151800(A007351(n)), the next prime after A007351(n). - Joshua Zucker, May 03 2006

Extensions

More terms from Joshua Zucker, May 03 2006
"odd" added to definition by N. J. A. Sloane, Sep 09 2015

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

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

A108547 Fixed points for prime number permutation A108546.

Original entry on oeis.org

2, 3, 5, 7, 17, 19, 41, 43, 461, 463, 26833, 26839, 26849, 26879, 26881, 26891, 26893, 26903, 26921, 26927, 616769, 616783, 616793, 616799, 616829, 617039, 617257, 617471, 617473, 617479, 617509, 617587, 617681, 617723, 618437, 618439, 618521
Offset: 1

Views

Author

Reinhard Zumkeller, Jun 10 2005

Keywords

Comments

Primes p such that A108546(A049084(p)) = p.

Crossrefs

Programs

  • PARI
    default(primelimit,10^8); s = 0; print1(2, ", "); forprime (p = 3, 10^8, if (p%4 == 3, s++; if (s == 1, print1(p, ", ")), s--; if (s == 0, print1(p, ", ")))); \\ David Wasserman, May 19 2008

Extensions

Corrected by T. D. Noe, Oct 25 2006
More terms from David Wasserman, May 19 2008

A274122 Let F(g,p) be the frequency of g up to prime nextprime(p+1). Primes p such that F(2,p) = F(4,p) and g = 2 or 4.

Original entry on oeis.org

97, 103, 109, 137, 163, 397, 457, 463, 569, 613, 739, 821, 827, 857, 2111, 2137, 2203, 2239, 2269, 2309, 2347, 2381, 4127, 4217, 8803, 9337, 12487, 12739, 12889, 12917, 19991, 20021, 20717, 20747, 20771, 20959, 21187, 21313, 21319, 21379, 21599, 21613, 21817, 21859, 22037, 22091, 22129, 22157, 22271, 22277, 22481, 22567
Offset: 1

Views

Author

David A. Corneth, Jun 10 2016

Keywords

Comments

Gaps 2 and 4 are conjectured to occur roughly equally often and each occur infinitely often (see link "Polignac's conjecture").
Conjecture: This sequence is infinite.

Examples

			Up to 89, gaps 2 and 4 occur respectively 8 and 7 times. After 97 (the next prime after 89), there is a gap of 4. So up to 97, gaps 2 and 4 occur the same number of times and the gap after 97 is 2 or 4, so 97 is in the sequence.
		

Crossrefs

Programs

  • PARI
    \\ See link by name "PARI program" for an extended version with comments.
    upto(n) = {my(gapcount=List(),is24 = List()); n=max(n,3); forprime(i=3,n, g = nextprime(i+1) - i; for(i=#gapcount+1,g\2, listput(gapcount, 0));
    gapcount[g\2]++; if(g<6&&#gapcount>1,if(gapcount[1]==gapcount[2],listput(is24,i)))); is24} \\ David A. Corneth, Jun 28 2016
Showing 1-10 of 23 results. Next