OFFSET
1,2
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (2,1,-4,1,2,-1).
FORMULA
a(n) = 3n * (n^2 - floor(n^2/4)) - Sum_{i=1..n} (2*i^2 - floor(i^2/4)) - Sum_{i=1..floor((n-1)/2)} (n + i) * (n - 2i).
From Colin Barker, Jan 24 2014: (Start)
a(n) = (-1+(-1)^n-(1+3*(-1)^n)*n-6*n^2+22*n^3)/16.
G.f.: x*(2*x^4+8*x^3+15*x^2+7*x+1) / ((x-1)^4*(x+1)^2). (End)
a(n) = Sum_{j=0..n-2} (Sum_{i=n+1+floor(j/2)-floor(1/j+1)..n+2*(j+1)} i), n > 1. - Wesley Ivan Hurt, Feb 10 2014
a(n) = 2*a(n-1)+a(n-2)-4*a(n-3)+a(n-4)+2*a(n-5)-a(n-6). - Wesley Ivan Hurt, Nov 19 2021
EXAMPLE
Add first columns for a(n)..
13 + 1 + 1
12 + 2 + 1
11 + 3 + 1
10 + 4 + 1
9 + 5 + 1
8 + 6 + 1
7 + 7 + 1
10 + 1 + 1 11 + 2 + 2
9 + 2 + 1 10 + 3 + 2
8 + 3 + 1 9 + 4 + 2
7 + 4 + 1 8 + 5 + 2
6 + 5 + 1 7 + 6 + 2
7 + 1 + 1 8 + 2 + 2 9 + 3 + 3
6 + 2 + 1 7 + 3 + 2 8 + 4 + 3
5 + 3 + 1 6 + 4 + 2 7 + 5 + 3
4 + 4 + 1 5 + 5 + 2 6 + 6 + 3
4 + 1 + 1 5 + 2 + 2 6 + 3 + 3 7 + 4 + 4
3 + 2 + 1 4 + 3 + 2 5 + 4 + 3 6 + 5 + 4
1 + 1 + 1 2 + 2 + 2 3 + 3 + 3 4 + 4 + 4 5 + 5 + 5
3(1) 3(2) 3(3) 3(4) 3(5) .. 3n
---------------------------------------------------------------------
1 9 34 81 163 .. a(n)
MATHEMATICA
Table[3 n (n^2 - Floor[n^2/4]) - Sum[2 i^2 - Floor[i^2/4], {i, n}] -
Sum[(n + i) (n - 2 i), {i, Floor[(n - 1)/2]}], {n, 100}]
LinearRecurrence[{2, 1, -4, 1, 2, -1}, {1, 9, 34, 81, 163, 282}, 50] (* Harvey P. Dale, Nov 11 2017 *)
PROG
(PARI) Vec(x*(2*x^4+8*x^3+15*x^2+7*x+1)/((x-1)^4*(x+1)^2) + O(x^100)) \\ Colin Barker, Jan 24 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Jan 23 2014
STATUS
approved