OFFSET
1,2
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,3,-3,0,-3,3,0,1,-1).
FORMULA
a(n) = 3*floor(n/3)*(floor(n/3) + 1)/2 + floor((n+1)/3)*(3*floor((n+1)/3)^2 - 1) + n*(floor((n-1)/3) - floor((n-2)/3)).
From Colin Barker, Sep 16 2018: (Start)
G.f.: x*(1 + x + 3*x^2 + x^3 + 13*x^4 - 3*x^5 - 2*x^6 + 4*x^7) / ((1 - x)^4*(1 + x + x^2)^3).
a(n) = a(n-1) + 3*a(n-3) - 3*a(n-4) - 3*a(n-6) + 3*a(n-7) + a(n-9) - a(n-10) for n>10.
(End)
EXAMPLE
a(1) = 1;
a(2) = 1*2 = 2;
a(3) = 1*2 + 3 = 5;
a(4) = 1*2 + 3 + 4 = 9;
a(5) = 1*2 + 3 + 4*5 = 25;
a(6) = 1*2 + 3 + 4*5 + 6 = 31;
a(7) = 1*2 + 3 + 4*5 + 6 + 7 = 38;
a(8) = 1*2 + 3 + 4*5 + 6 + 7*8 = 87;
a(9) = 1*2 + 3 + 4*5 + 6 + 7*8 + 9 = 96;
a(10) = 1*2 + 3 + 4*5 + 6 + 7*8 + 9 + 10 = 106;
a(11) = 1*2 + 3 + 4*5 + 6 + 7*8 + 9 + 10*11 = 206;
a(12) = 1*2 + 3 + 4*5 + 6 + 7*8 + 9 + 10*11 + 12 = 218; etc.
MAPLE
seq(coeff(series((x*(1+x+3*x^2+x^3+13*x^4-3*x^5-2*x^6+4*x^7))/((1-x)^4*(1+x+x^2)^3), x, n+1), x, n), n = 1 .. 50); # Muniru A Asiru, Sep 16 2018
MATHEMATICA
Table[3*Floor[n/3]*(Floor[n/3] + 1)/2 + Floor[(n + 1)/3]*(3*Floor[(n + 1)/3]^2 - 1) + n*(Floor[(n - 1)/3] - Floor[(n - 2)/3]), {n, 50}]
LinearRecurrence[{1, 0, 3, -3, 0, -3, 3, 0, 1, -1 }, {1, 2, 5, 9, 25, 31, 38, 87, 96, 106}, 50] (* Stefano Spezia, Sep 16 2018 *)
PROG
(PARI) Vec(x*(1 + x + 3*x^2 + x^3 + 13*x^4 - 3*x^5 - 2*x^6 + 4*x^7) / ((1 - x)^4*(1 + x + x^2)^3) + O(x^40)) \\ Colin Barker, Sep 16 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Sep 15 2018
STATUS
approved