OFFSET
0,2
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,1,-1).
FORMULA
G.f.: (1 + 3*x) / (1 - x - x^4 + x^5).
From Luce ETIENNE, Jan 28 2017: (Start)
a(n) = a(n-1)+ a(n-4)- a(n-5).
a(n) = (4*n+7-(-1)^n+(-1)^((2*n-1+(-1)^n)/4)-3*(-1)^((2*n+1-(-1)^n)/4))/4.
a(n) = (4*n+7-cos(n*Pi)-2*(cos(n*Pi/2)-2*sin(n*Pi/2)))/4.
(End)
EXAMPLE
G.f. = 1 + 4*x + 4*x^2 + 4*x^3 + 5*x^4 + 8*x^5 + 8*x^6 + 8*x^7 + 9*x^8 + ...
MATHEMATICA
Table[{n, Table[n+3, 3]}, {n, 1, 69, 4}]//Flatten (* Harvey P. Dale, Nov 08 2016 *)
LinearRecurrence[{1, 0, 0, 1, -1}, {1, 4, 4, 4, 5}, 75] (* Vincenzo Librandi, May 01 2018 *)
PROG
(PARI) {a(n) = if( n%4==0, n+1, n+4 - (n%4))}; /* Michael Somos, Jan 28 2017 */
(PARI) Vec((1 + 3*x) / ((1 - x)^2*(1 + x)*(1 + x^2)) + O(x^100)) \\ Colin Barker, Jan 28 2017
(Magma) [Round((4*n+7-(-1)^n+(-1)^((2*n-1+(-1)^n)/4)-3*(-1)^((2*n+1- (-1)^n )/4))/4): n in [0..50]]; // G. C. Greubel, Apr 30 2018
(Magma) I:=[1, 4, 4, 4, 5]; [n le 5 select I[n] else Self(n-1)+Self(n-4)- Self(n-5): n in [1..80]]; // Vincenzo Librandi, May 01 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Philippe Deléham, Apr 06 2007
STATUS
approved