OFFSET
1
COMMENTS
First differs from A115788 at a(113).
LINKS
Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,0,0,1).
FORMULA
From Hieronymus Fischer, Apr 30 2012: (Start)
a(n) = (1+(-1)^((n-1) mod 7))/2.
a(n) = 1-((n-1) mod 7) mod 2.
G.f.: x*(1-x^8)/((1-x^2)*(1-x^7)).
Also: x*(1+x^2)*(1+x^4)/(1-x^7). (End)
From Wesley Ivan Hurt, Jul 11 2016: (Start)
a(n) = a(n-7) for n>7.
a(n) = 1 - Sum_{k=1..6} floor((n + k - 1)/7)*(-1)^k. (End)
MAPLE
a:= n-> [1, 0, 1, 0, 1, 0, 1][1+irem(n+6, 7)]:
seq(a(n), n=1..150); # Alois P. Heinz, Jan 22 2012
MATHEMATICA
PadRight[{}, 130, {1, 0, 1, 0, 1, 0, 1}] (* Harvey P. Dale, Feb 14 2015 *)
Table[Boole@ Or[OddQ@ #, # == 0] &@ Mod[n, 7], {n, 120}] (* or *)
Rest@ CoefficientList[Series[x (1 - x^8)/((1 - x^2) (1 - x^7)), {x, 0, 120}], x] (* or *)
Table[1 - Sum[Floor[(n + k - 1)/7] (-1)^k, {k, 6} ], {n, 120}] (* Michael De Vlieger, Jul 13 2016 *)
PROG
&cat [[1, 0, 1, 0, 1, 0, 1]^^20]; // Wesley Ivan Hurt, Jul 11 2016
(PARI) a(n)=1-(n-1)%7%2 \\ Charles R Greathouse IV, Jul 13 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Omar E. Pol, Jan 22 2012
STATUS
approved