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-8 of 8 results.

A066520 Number of primes of the form 4m+3 <= n minus number of primes of the form 4m+1 <= n.

Original entry on oeis.org

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

Views

Author

Sharon Sela (sharonsela(AT)hotmail.com), Jan 05 2002

Keywords

Comments

Although the initial terms are nonnegative, it has been proved that infinitely many terms are negative. The first two are a(26861)=a(26862)=-1. Next there are 3404 values of n in the range 616841 to 633798 with a(n)<0. Then 27218 values in the range 12306137 to 12382326.
Partial sums of A151763. - Reinhard Zumkeller, Feb 06 2014

Crossrefs

Cf. A156749 Sequence showing Chebyshev bias in prime races (mod 4). [From Daniel Forgues, Mar 26 2009]
Let d be a fundamental discriminant.
Sequences of the form "a(n) = -Sum_{primes p<=n} Kronecker(d,p)" with |d| <= 12: A321860 (d=-11), A320857 (d=-8), A321859 (d=-7), this sequence (d=-4), A321856 (d=-3), A321857 (d=5), A071838 (d=8), A321858 (d=12).
Sequences of the form "a(n) = -Sum_{i=1..n} Kronecker(d,prime(i))" with |d| <= 12: A321865 (d=-11), A320858 (d=-8), A321864 (d=-7), A038698 (d=-4), A112632 (d=-3), A321862 (d=5), A321861 (d=8), A321863 (d=12).

Programs

  • Haskell
    a066520 n = a066520_list !! (n-1)
    a066520_list = scanl1 (+) $ map (negate . a151763) [1..]
    -- Reinhard Zumkeller, Feb 06 2014
  • Mathematica
    a[n_] := Length[Select[Range[3, n, 4], PrimeQ]]-Length[Select[Range[1, n, 4], PrimeQ]]
    f[n_]:=Module[{c=Mod[n,4]},Which[!PrimeQ[n],0,c==3,1,c==1,-1]]; Join[{0,0}, Accumulate[Array[f,110,3]]] (* Harvey P. Dale, Mar 03 2013 *)

Formula

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

Extensions

Edited by Dean Hickerson, Mar 05 2002

A079261 Characteristic function of primes of form 4n+3 (1 if n is prime of form 4n+3, 0 otherwise).

Original entry on oeis.org

0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0
Offset: 1

Views

Author

Benoit Cloitre, Feb 04 2003

Keywords

Comments

Let M(n) denote the n X n matrix m(i,j)=0 if n divides ij-1, m(i,j) = 1 otherwise then det(M(n))=+1 if and only if n is prime ==3 (mod 4).
a(A002145(n)) = 1; a(A145395(n)) = 0. [From Reinhard Zumkeller, Oct 12 2008]
a(n) * A151763(n) = - a(n).

Crossrefs

Cf. A066490 (partial sums).

Programs

  • Haskell
    a079261 n = fromEnum $ n `mod` 4 == 3 && a010051 n == 1
    -- Reinhard Zumkeller, Oct 06 2011
  • Mathematica
    Table[If[PrimeQ[n]&&Mod[n,4]==3,1,0],{n,120}] (* Harvey P. Dale, Apr 26 2025 *)
  • PARI
    { a(n)=isprime(n)*if(n%4-3,0,1) }; vector(100,n,a(n))
    

Formula

a(n) = - A010051(n) * A011764(n+1). [Reinhard Zumkeller, Oct 06 2011]

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

A066339 Number of primes p of the form 4m+1 with p <= n.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11
Offset: 1

Views

Author

Sharon Sela (sharonsela(AT)hotmail.com), Jan 01 2002

Keywords

Comments

Asymptotic expansion: a(n) ~ pi(n)/2 ~ n/(2log(n)) (pi(n) is in sequence A000720).
Partial sums of A079260. - Reinhard Zumkeller, Feb 06 2014

Crossrefs

Programs

  • Haskell
    a066339 n = a066339_list !! (n-1)
    a066339_list = scanl1 (+) $ map a079260 [1..]
    -- Reinhard Zumkeller, Feb 06 2014
  • Mathematica
    Table[ Length[ Select[ Union[ Table[ Prime[ PrimePi[i]], {i, 2, n}]], Mod[ #, 4] == 1 & ]], {n, 2, 100} ]
  • PARI
    for(n=1,200,print1(sum(i=1,n,if((i*isprime(i)-1)%4,0,1)),","))
    

Formula

a(n) + A066490(n) = A000720(n) - 1 for n >= 2. - Jianing Song, Apr 28 2021

Extensions

More terms from Robert G. Wilson v, Jan 03 2002

A062711 Number of prime Gaussian integers z=a+bi with |z|<=n.

Original entry on oeis.org

0, 1, 4, 6, 8, 10, 15, 19, 21, 25, 32, 34, 38, 44, 46, 52, 60, 66, 73, 79, 87, 93, 98, 104, 114, 122, 128, 138, 146, 154, 163, 173, 181, 193, 203, 213, 221, 231, 239, 245, 259, 273, 280, 294, 304, 316, 327, 343, 359, 369
Offset: 1

Views

Author

Reiner Martin, Jul 14 2001

Keywords

Crossrefs

Programs

  • Mathematica
    m = 50;
    t = Table[x + y I, {x, -m, m}, {y, -m, m}] // Flatten[#, 1]& // Select[#, PrimeQ[#, GaussianIntegers -> True]& ]& // Sort // DeleteDuplicates[#, Abs[#1] == Abs[#2] && MatchQ[#1 /#2 , 1|-1|I|-I]& ]&;
    a[n_] := Select[t, Abs[#] <= n&] // Length;
    Array[a, m] (* Jean-François Alcover, Jul 29 2016 *)

Formula

Two prime Gaussian integers are not counted separately if they are associated, i.e. if their quotient is a unit (1, i, -1 or -i).
Similar to the ordinary prime number theorem (see A000720) we have the asymptotic expression: a(n) ~ n^2/(2 * log(n)) - Ahmed Fares (ahmedfares(AT)my-deja.com), Jul 16 2001
a(1)=0, a(n)=1+A066339(n^2)+A066490(n) for n>0. - T. D. Noe, Feb 20 2007

A340764 Number of primes p <= n that are congruent to 2 modulo 3.

Original entry on oeis.org

0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13
Offset: 1

Views

Author

Jianing Song, Apr 28 2021

Keywords

Examples

			There are 13 primes <= 100 that are congruent to 2 modulo 3, namely 2, 5, 11, 17, 23, 29, 41, 47, 53, 59, 71, 83, 89, so a(100) = 13.
		

Crossrefs

Programs

  • Mathematica
    Accumulate[Table[If[PrimeQ[n]&&Mod[n,3]==2,1,0],{n,90}]] (* Harvey P. Dale, May 12 2022 *)
  • PARI
    a(n) = sum(i=1, n, isprime(i) && (i%3==2))

Formula

A340763(n) + a(n) = A000720(n) - 1 for n >= 3.

A340763 Number of primes p <= n that are congruent to 1 modulo 3.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
Offset: 1

Views

Author

Jianing Song, Apr 28 2021

Keywords

Examples

			There are 11 primes <= 100 that are congruent to 1 modulo 3, namely 7, 13, 19, 31, 37, 43, 61, 67, 73, 79, 97, so a(100) = 11.
		

Crossrefs

Programs

  • PARI
    a(n) = sum(i=1, n, isprime(i) && (i%3==1))

Formula

a(n) + A340764(n) = A000720(n) - 1 for n >= 3.

A348195 Number of primes of the form 4k+3 < n^2.

Original entry on oeis.org

0, 1, 2, 3, 5, 6, 8, 9, 12, 13, 15, 18, 21, 23, 26, 29, 32, 34, 37, 40, 43, 47, 52, 55, 59, 63, 67, 70, 75, 79, 83, 88, 93, 97, 101, 106, 111, 115, 123, 131, 136, 140, 146, 151, 157, 164, 169, 174, 181, 186, 193, 200, 207, 213, 221, 225, 230, 241, 246, 255, 263, 269, 280, 287, 294, 301, 308, 316, 326, 331, 343, 353, 358
Offset: 1

Views

Author

Seiichi Manyama, Oct 06 2021

Keywords

Crossrefs

Programs

  • PARI
    a(n) = sum(k=2, n^2-1, isprime(k)&&k%4==3);

Formula

a(n) = A066490(n^2).
Showing 1-8 of 8 results.