OFFSET
0,4
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,1,-1).
FORMULA
a(n) = floor(n/4) - (n mod 4) mod 3 + floor((2 + n mod 4)/2).
a(n) = (2*n + 3 + 6*cos(n*Pi/2) - cos(n*Pi) - 6*sin(n*Pi/2))/8. - Wesley Ivan Hurt, Oct 01 2017
a(n + 4) = a(n) + 1 so a(n + 8) = 2 * a(n + 4) - a(n). - David A. Corneth, Oct 02 2017
G.f.: (1 + 2*x^3 - x - x^4)/((1 + x)*(1 - x)^2*(1 + x^2)). - R. J. Mathar, May 22 2019
E.g.f.: (3*cos(x) + cosh(x)*(1 + x) - 3*sin(x) + (2 + x)*sinh(x))/4. - Stefano Spezia, Jan 03 2023
MATHEMATICA
A028242[n_] := (1 + 2*n + 3*(-1)^n)/4; Table[A028242[Ceiling[n/2]], {n, 0, 100}] (* G. C. Greubel, Sep 03 2017 *)
LinearRecurrence[{1, 0, 0, 1, -1}, {1, 0, 0, 2, 2}, 100] (* Harvey P. Dale, Jul 05 2020 *)
PROG
(PARI) vector(100, n, n--; (1/4)*(1 + 2*ceil(n/2) + 3*(-1)^(ceil(n/2)))) \\ G. C. Greubel, Sep 03 2017
(PARI) a(n) = (n\4) + [1, 0, 0, 2][1+n%4] \\ David A. Corneth, Oct 02 2017
(PARI) first(n) = my(c = res = [1, 0, 0, 2]); for(i=1, (n-1)\4, c += [1, 1, 1, 1]; res = concat(res, c)); res \\ David A. Corneth, Oct 02 2017
(Magma) b:= func< n | (1 + 2*n + 3*(-1)^n)/4 >; [b(Ceiling(n/2)): n in [0..100]]; // G. C. Greubel, May 22 2019
(Sage) ((1+2*x^3-x-x^4)/((1-x)*(1-x^4))).series(x, 100).coefficients(x, sparse=False) # G. C. Greubel, May 22 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Reinhard Zumkeller, Aug 05 2005
STATUS
approved