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

A217054 Odd number version of the prime constant (A101264 interpreted as a binary number).

Original entry on oeis.org

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

Views

Author

Alonso del Arte, Sep 25 2012

Keywords

Comments

The prime constant (A051006) is essentially a set of flags that tell us whether a given integer is prime. But since all even numbers (except 2) are composite, every other bit is guaranteed to be 0.
Depending on the algorithm for which this is used, it may be more efficient to store a set of flags for just the odd numbers (and handle 2 as a special case). Lehmer (1969) suggests using about 64 kilobytes for the storage of this "characteristic number."

Examples

			1/2 + 1/4 + 1/8 + 1/32 + 1/64 + ... = 0.928319591...
		

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.

Programs

  • Mathematica
    RealDigits[Sum[1/2^((Prime[k] - 1)/2), {k, 2, 1000}], 10, 100][[1]]
  • PARI
    s=0; forprime(p=3, default(realprecision)*log(100)\log(2)+9, s += 1.>>(p\2)); s \\ Charles R Greathouse IV, Sep 26 2012

Formula

sum(k = 1 .. infinity, chi(2k + 1)/2^k), where chi(n) is the characteristic function of the prime numbers (A010051).
sum(k = 2 .. infinity, 1/2^((p(k) - 1)/2)), where p(k) is the k-th prime number.

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

A085090 If 2n-1 is prime then a(n) = 2n-1, otherwise a(n) = 0.

Original entry on oeis.org

0, 3, 5, 7, 0, 11, 13, 0, 17, 19, 0, 23, 0, 0, 29, 31, 0, 0, 37, 0, 41, 43, 0, 47, 0, 0, 53, 0, 0, 59, 61, 0, 0, 67, 0, 71, 73, 0, 0, 79, 0, 83, 0, 0, 89, 0, 0, 0, 97, 0, 101, 103, 0, 107, 109, 0, 113, 0, 0, 0, 0, 0, 0, 127, 0, 131, 0, 0, 137, 139, 0, 0, 0, 0, 149, 151, 0, 0, 157, 0, 0, 163
Offset: 1

Views

Author

Amarnath Murthy and Meenakshi Srikanth (menakan_s(AT)yahoo.com), Jul 02 2003

Keywords

Comments

Previous name was: Starting with n+(n-1) go on adding n-2, then n-3, etc. until one gets a prime; a(n) = smallest prime in n+(n-1)+(n-2)+...+(n-i) (with the least i that gives a prime), or 0 if no such prime exists.

Examples

			a(8) = 0 as there is no prime in the partial sum of the finite sequence 8,7,6,5,4,3,2,1.
a(7) = 13 = 7 + 6.
		

Crossrefs

Cf. A122845.

Programs

  • Magma
    DoubleFactorial:=func< n | &*[n..2 by -2] >; [ DoubleFactorial(-5 + 4*n) mod (-1 + 2*n)^2: n in [1..90]]; // Vincenzo Librandi, Oct 04 2018
    
  • Magma
    [IsPrime(2*n-1) select 2*n-1 else 0: n in [1..90]]; // Bruno Berselli, Oct 05 2018
  • Mathematica
    apr[n_]:=Module[{cl=Select[Rest[Accumulate[Range[n,1,-1]]],PrimeQ, 1]}, If[cl=={},0,First[cl]]]; Array[apr,100] (* Harvey P. Dale, Jun 01 2012 *)
    b[n_] := Mod[(-5 + 4 n)!!, (-1 + 2 n)^2]; a = Array[b, 82] (* Fred Daniel Kline, Oct 04 2018; Thomas Ordowski's formula with adjusted index *)
  • PARI
    a(n) = if (isprime(p=2*n-1), p, 0); \\ Michel Marcus, Aug 09 2018
    

Formula

If 2n-1 is prime then a(n) = 2n-1, otherwise a(n) = 0. - David Wasserman, Jan 25 2005
a(A098090(n)-1)=2*A098090(n)-3; a(n)=(2*n-1)*A101264(n-1). - Reinhard Zumkeller, Sep 14 2006
a(n+1) = (4n-1)!! mod (2n+1)^2; by Gauss generalization of the Wilson's theorem. - Thomas Ordowski, Jul 23 2016

Extensions

More terms from David Wasserman, Jan 25 2005
New name using formula from David Wasserman, Joerg Arndt, Jul 24 2016

A156542 Number of distinct Sophie Germain prime factors of n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Feb 10 2009

Keywords

Crossrefs

Programs

Formula

a(n) <= A001221(n).
a(A156541(n)) = A001221(A156541(n)); a(A156543(n)) = 0.
a(A005384(n)) = 1; a(A053176(n)) = 0.
a(n) = Sum_{p|n} A101264(p), where p is a prime. - Ridouane Oudra, Aug 25 2019
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Sum_{k>=1} 1/A005384(k) (see A005384 for an estimate of this sum). - Amiram Eldar, Jun 03 2024

A086668 Number of divisors d of n such that 2d+1 is a prime.

Original entry on oeis.org

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

Views

Author

Jon Perry, Jul 27 2003

Keywords

Comments

From Antti Karttunen, Jun 15 2018: (Start)
Number of terms of A005097 that divide n.
For all n >= 1, a(n) > A156660(n). Specifically, a(p) = 2 for all p in A005384 (Sophie Germain primes), although 2's occur in other positions as well.
(End)

Examples

			10 has divisors 1,2,5 and 10 of which 2.1+1, 2.2+1 and 2.5+1 are prime, so a(10)=3
		

Crossrefs

One less than A046886.

Programs

Formula

From Antti Karttunen, Jun 15 2018: (Start)
a(n) = Sum_{d|n} A101264(d).
a(n) = A305818(n) + A101264(n).
(End)

Extensions

Definition modified by Harvey P. Dale, Apr 29 2015

A156707 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 the congruence (mod 4) if k(n) is prime and 0 if k(n) is composite.

Original entry on oeis.org

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

Views

Author

Daniel Forgues, Feb 13 2009, Feb 14 2009

Keywords

Comments

Expression for k(n): k(n) = 4*ceiling(n/2) + (-1)^n, so the parity of n gives us the congruence (mod 4) of k(n). - Daniel Forgues, Mar 01 2009

Crossrefs

The absolute values of this sequence give A101264 (for n > 0.) The partial sums of this sequence give A156749. - Daniel Forgues, Mar 01 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)).

A154804 Number of ways to represent 2*n as the sum of two distinct primes (counting 1 as a prime).

Original entry on oeis.org

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

Views

Author

Omar E. Pol, Jan 16 2009

Keywords

Comments

Number of ways to represent 2*n as the sum of two distinct noncomposite numbers. - Omar E. Pol, Dec 11 2024

Crossrefs

Formula

a(n) = A101264(n-1) + A061357(n). [From R. J. Mathar, Jan 21 2009]
a(n) = A001031(n) - A080339(n).

Extensions

More terms from R. J. Mathar, Jan 21 2009
Edited by Franklin T. Adams-Watters, Jan 31 2009

A305818 Number of proper divisors d of n such that 2d+1 is a prime.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jun 15 2018

Keywords

Comments

Number of terms of A005097 which are less than n that divide n.

Crossrefs

Programs

  • PARI
    A305818(n) = sumdiv(n, d, (d
    				

Formula

a(n) = Sum_{d|n, dA101264(d).
a(n) = A086668(n) - A101264(n).

A099801 PrimePi(2n+1), the number of primes less than or equal to 2n+1.

Original entry on oeis.org

0, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 9, 9, 10, 11, 11, 11, 12, 12, 13, 14, 14, 15, 15, 15, 16, 16, 16, 17, 18, 18, 18, 19, 19, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 24, 25, 25, 26, 27, 27, 28, 29, 29, 30, 30, 30, 30, 30, 30, 30, 31, 31, 32, 32, 32, 33, 34, 34, 34, 34, 34
Offset: 0

Views

Author

N. J. A. Sloane, Nov 19 2004

Keywords

Comments

If we drop a(0), 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 the number of primes up to a(k(n)). - Daniel Forgues, Mar 01 2009
For n > 0, equals 1 (to account for the even prime 2 which is not congruent to -1 or +1 (mod 4)) + partial sums of A101264 (for n > 0). - Daniel Forgues, Mar 01 2009

Crossrefs

Bisection of A000720.

Programs

Extensions

More terms from Emeric Deutsch, Apr 12 2005
Showing 1-10 of 20 results. Next