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

A101264 a(n) = 1 if 2*n + 1 is prime, otherwise a(n) = 0.

Original entry on oeis.org

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

Views

Author

Giovanni Teofilatto, Dec 18 2004

Keywords

Comments

Inverse Mobius transform of the sequence, after dropping a(0), yields A086668. - R. J. Mathar, Jan 25 2009
If we drop a(0) then we may describe the sequence as: for all numbers k(n) [k(n) = 4 ceiling(n/2) + (-1)^n] congruent to -1 or +1 (mod 4) starting with k(n) = {3,5,7,9,11,...}, a(k(n)) is 1 if k(n) is prime and 0 if k(n) is composite. - Daniel Forgues, Mar 01 2009

Examples

			a(1) = 1 because 2*1+1 = 3 is prime;
a(2) = 1 because 2*2+1 = 5 is prime;
a(3) = 1 because 2*3+1 = 7 is prime;
a(4) = 0 because 2*4+1 = 9 is composite.
		

References

  • D. H. Lehmer, "Computer Technology Applied to the Theory of Numbers," from Studies in Number Theory, ed. William J. LeVeque. Englewood Cliffs, New Jersey: Prentice Hall (1969): 138.

Crossrefs

Bisection (odd n) of A010051.
If we drop a(0), equals absolute value of A156707. - Daniel Forgues, Mar 01 2009

Programs

  • Magma
    [IsPrime(2*n+1) select 1 else 0: n in [1..100]]; // Marius A. Burtea, Aug 25 2019
    
  • Maple
    with(numtheory): a:= proc(n) if isprime(2*n+1)=true then 1 else 0 fi end:
    seq(a(n), n=0..80); # Ridouane Oudra, Aug 25 2019
  • Mathematica
    Table[If[PrimeQ[2n + 1], 1, 0], {n, 0, 104}] (* Ray Chandler, Jan 09 2005 *)
    Table[Boole[PrimeQ[n]], {n, 1, 209, 2}] (* Alonso del Arte, Sep 25 2012 *)
  • PARI
    first(n) = {my(res = vector(n)); forprime(p = 3, 2*n - 1, res[p \ 2] = 1); res} \\ David A. Corneth, Aug 25 2019

Formula

a(n) = A057427(A085090(n+1)). - Reinhard Zumkeller, Sep 14 2006
For n > 0, a(n) = (2n-1)! mod (2n+1). - Thomas Ordowski, Jul 23 2016
a(n) = pi(2*n+1) - pi(2*n), where pi(n) = A000720(n). - Ridouane Oudra, Aug 25 2019

Extensions

Corrected by Ray Chandler, Jan 09 2005

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

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

Original entry on oeis.org

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

Views

Author

Daniel Forgues, Mar 29 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 6 taking away opportunities for primes to appear in the quadratic residue class +1 (mod 6), while the non-quadratic residue class -1 (mod 6) is squarefree.
The density of squares congruent to +1 (mod 6) is 1/(6*sqrt(k(n))) since 1/3 of the squares are congruent to +1 (mod 6), while the density of primes in either residue classes -1 or +1 (mod 6) is 1/(phi(6)*log(k(n))), with phi(6) = 2.
Here 1 is a quadratic residue mod 6, but 5 (or equivalently -1) is a quadratic non-residue mod 6. 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/(6*sqrt(k(n))) is o(1/(phi(6)*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 6 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, {6, 1})/x and pi(x, {6, 5})/x in either congruence class.
Since 1/(6*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, {6, 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 6) [indexed from n = 1 to 33332, with k(n) = 6 ceiling(n/2) + (-1)^n], a tie, where a(k(n)) = 0, is attained or maintained for only 9 integers, and that bias favoring the non-quadratic residue class -1 (mod 6) never gets violated, i.e., a(k(n)) is never +1.

References

  • R. Crandall and C. Pomerance, "Prime Numbers - A Computational Perspective", Second Edition, Springer Verlag 2005, ISBN 0-387-25282-7

Crossrefs

Cf. A156706 (whose sum of first n terms gives a(n)).
Cf. A156749 (which exhibits the Chebyshev Bias for congruences -1 or +1 (mod 4)).
Cf. A156707 (whose sum of first n terms gives A156749(n)).
Cf. A075743 (prime characteristic function of numbers congruent to -1 or +1 (mod 6)).
Cf. A101264 (prime characteristic function of numbers congruent to -1 or +1 (mod 4)).
Showing 1-3 of 3 results.