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.

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