OFFSET
1,2
COMMENTS
Sum of integers followed by squares.
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (1,3,-3,-3,3,1,-1).
FORMULA
a(n) = (n^3+3*n^2+8*n+r(n))/24, where r(n) = 3*n+9 if n is odd, 3*n^2 if n is even.
G.f.: x*(1+x-x^2+x^3)/((1+x)^3*(x-1)^4). - R. J. Mathar, Apr 20 2009
a(n) = a(n-1)+3*a(n-2)-3*a(n-3)-3*a(n-4)+3*a(n-5)+a(n-6)-a(n-7). - R. J. Mathar, Apr 20 2009
a(n) = (2*n^3+9*n^2+19*n+9+3*(n^2-n-3)*(-1)^n)/48. - Luce ETIENNE, Dec 29 2014
E.g.f.: (2*x^3+15*x^2+30*x+9)*exp(x)/48 +(x^2-3)*exp(-x)/16. - Robert Israel, Dec 30 2014
EXAMPLE
For n=9, a(n) = 1+1+2+4+3+9+4+16+5 = 45.
MAPLE
seq((2*n^3+9*n^2+19*n+9+3*(n^2-n-3)*(-1)^n)/48, n=1..100); # Robert Israel, Dec 30 2014
MATHEMATICA
CoefficientList[Series[x*(1+x-x^2+x^3)/((1+x)^3*(x-1)^4), {x, 0, 50}], x] (* or *) Table[(2*n^3+9*n^2+19*n+9+3*(n^2-n-3)*(-1)^n)/48, {n, 0, 50}] (* G. C. Greubel, Jun 02 2018 *)
Accumulate[Flatten[{#, #^2}&/@Range[30]]] (* Harvey P. Dale, Nov 30 2019 *)
PROG
(Magma) S:=&cat[ [ n, n^2 ]: n in [1..25] ]; [ n eq 1 select S[1] else Self(n-1)+S[n]: n in [1..#S] ]; // Klaus Brockhaus, Apr 20 2009
(Haskell)
a159693 n = a159693_list !! (n-1)
a159693_list = scanl1 (+) a000463_list -- Reinhard Zumkeller, Nov 08 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Gerald Hillier, Apr 20 2009
EXTENSIONS
More terms from R. J. Mathar and Klaus Brockhaus, Apr 20 2009
STATUS
approved