login
A127932
a(4*n) = 4*n+1, a(4*n+1) = a(4*n+2) = a(4*n+3) = 4*n+4.
3
1, 4, 4, 4, 5, 8, 8, 8, 9, 12, 12, 12, 13, 16, 16, 16, 17, 20, 20, 20, 21, 24, 24, 24, 25, 28, 28, 28, 29, 32, 32, 32, 33, 36, 36, 36, 37, 40, 40, 40, 41, 44, 44, 44, 45, 48, 48, 48, 49, 52, 52, 52, 53, 56, 56, 56, 57, 60, 60, 60, 61, 64, 64, 64, 65, 68, 68, 68, 69, 72, 72, 72
OFFSET
0,2
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
Sequence in context: A036858 A131957 A342348 * A006075 A342576 A370389
KEYWORD
nonn,easy
AUTHOR
Philippe Deléham, Apr 06 2007
STATUS
approved