OFFSET
0,1
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
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.
LINKS
Daniel Forgues, Table of n, a(n) for n=0..49999
FORMULA
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
EXAMPLE
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.
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 *)
PROG
(Magma) [IsPrime(2*n+1) select 1 else 0: n in [1..100]]; // Marius A. Burtea, Aug 25 2019
(PARI) first(n) = {my(res = vector(n)); forprime(p = 3, 2*n - 1, res[p \ 2] = 1); res} \\ David A. Corneth, Aug 25 2019
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Giovanni Teofilatto, Dec 18 2004
EXTENSIONS
Corrected by Ray Chandler, Jan 09 2005
STATUS
approved