OFFSET
1,2
COMMENTS
The maximum obtainable is A000330, the square pyramidal numbers. Problem suggested by Leroy Quet.
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (4,-7,8,-7,4,-1).
FORMULA
a(n) = T(n) + e(n), where T(n) = n(n+1)(n+2)/6 = A000292(n) is the tetrahedral numbers and e(n) = 0 if n = 0,1 (mod 4) and 1 if n = 2,3 (mod 4). (Published by Rob Johnson in sci.math.)
G.f.: x*(1+2*x-x^2)*(1-x+x^2)/((1-x)^4*(1+x^2)). [Colin Barker, Apr 30 2012]
a(n) = 4*a(n-1) -7*a(n-2) +8*a(n-3) -7*a(n-4) +4*a(n-5) -a(n-6). - Vincenzo Librandi, Jun 27 2012
MATHEMATICA
CoefficientList[Series[(1+2*x-x^2)*(1-x+x^2)/((1-x)^4*(1+x^2)), {x, 0, 50}], x] (* Vincenzo Librandi, Jun 27 2012 *)
PROG
(Magma) I:=[1, 5, 11, 20, 35, 57]; [n le 6 select I[n] else 4*Self(n-1)-7*Self(n-2)+8*Self(n-3)-7*Self(n-4)+4*Self(n-5)-Self(n-6): n in [1..50]]; // Vincenzo Librandi, Jun 27 2012
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Franklin T. Adams-Watters, May 15 2006
STATUS
approved