A110659 a(n) = A028242(A110654(n)).
1, 0, 0, 2, 2, 1, 1, 3, 3, 2, 2, 4, 4, 3, 3, 5, 5, 4, 4, 6, 6, 5, 5, 7, 7, 6, 6, 8, 8, 7, 7, 9, 9, 8, 8, 10, 10, 9, 9, 11, 11, 10, 10, 12, 12, 11, 11, 13, 13, 12, 12, 14, 14, 13, 13, 15, 15, 14, 14, 16, 16, 15, 15, 17, 17, 16, 16, 18, 18, 17, 17, 19, 19, 18, 18, 20, 20, 19, 19, 21, 21, 20
Offset: 0
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).
Programs
-
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
-
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 *)
-
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
-
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
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