OFFSET
1,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,0,1,-1).
FORMULA
a(n) = 2k - 1 for n = {6k - 5, 6k - 3}, where k = 1,2,3,... a(n) = 2k for n = {6k - 4, 6k - 2, 6k - 1, 6k}, where k = 1,2,3,... - Alexander Adamchuk, Nov 08 2006
G.f.: x*(1+x-x^2+x^3)/((1-x)*(1-x^6)). - G. C. Greubel, Aug 07 2019
MAPLE
seq(coeff(series(x*(1+x-x^2+x^3)/((1-x)*(1-x^6)), x, n+1), x, n), n = 1..80); # G. C. Greubel, Aug 07 2019
MATHEMATICA
f[n_]:= Floor[n/2] - Floor[n/6]; Table[f[2n] - f[n-1], {n, 80}] (* Robert G. Wilson v *)
Table[Count[Range[n, 2n], _?(MemberQ[{2, 4}, Mod[#, 6]]&)], {n, 80}] (* Harvey P. Dale, Mar 25 2019 *)
LinearRecurrence[{1, 0, 0, 0, 0, 1, -1}, {1, 2, 1, 2, 2, 2, 3}, 80] (* G. C. Greubel, Aug 07 2019 *)
PROG
(PARI) my(x='x+O('x^80)); Vec(x*(1+x-x^2+x^3)/((1-x)*(1-x^6))) \\ G. C. Greubel, Aug 07 2019
(Magma) R<x>:=PowerSeriesRing(Integers(), 80); Coefficients(R!( x*(1+x-x^2+x^3)/((1-x)*(1-x^6)) )); // G. C. Greubel, Aug 07 2019
(Sage)
def A123920_list(prec):
P.<x> = PowerSeriesRing(ZZ, prec)
return P( x*(1+x-x^2+x^3)/((1-x)*(1-x^6)) ).list()
a=A123920_list(80); a[1:] # G. C. Greubel, Aug 07 2019
(GAP) a:=[1, 2, 1, 2, 2, 2, 3];; for n in [8..80] do a[n]:=a[n-1]+a[n-6]-a[n-7]; od; a; # G. C. Greubel, Aug 07 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Giovanni Teofilatto, Oct 29 2006
EXTENSIONS
Corrected and extended by Robert G. Wilson v, Oct 29 2006
More terms from Alexander Adamchuk, Nov 08 2006
STATUS
approved