OFFSET
1,1
REFERENCES
Concrete Mathematics, R. L. Graham, D. E. Knuth, O. Patashnik, 1994, Addison-Wesley Company, Inc.
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
FORMULA
For n odd, t = (n+1)/2, a(n) = ((2*t*(t+1)*(t^2+t+4))/3)+1;
for n even, t = n/2, a(n) = (((2*t*(t+1)*(t^2+t+4))/3)+1)+((2*t+1)*(2*t^2+2*t+3))/3.
EXAMPLE
For n=5, n is odd; t=3; a(5) = (2*3*(3+1)*(3^2+3+4)/3)+1 = ((6*4*16)/3)+1 = 129.
For n=6, n is even; t=3; a(6) = a(5) + ((2*3+1)*(2*t^2+2*t+3))/3 = 129 + (7*27)/3 = 192.
MAPLE
for n from 1 to k do if ((n mod 2 ) = 1) then t := (n+1)/2; a[n] := ((2*(t*(t+1)*(t^2+t+4))/3)+1); else t := (n)/2; a[n] := ((2*(t*(t+1)*(t^2+t+4)/3)+1)+(2*t+1)*(2*t^2+2*t+3)/3); fi; print(a[n]); od;
MATHEMATICA
Array[((2 #2 (#2 + 1) (#2^2 + #2 + 4))/3) + 1 + (Boole[EvenQ[#1]]*((2 #2 + 1) (2 #2^2 + 2 #2 + 3))/3) & @@ {#, (# + Boole[OddQ[#]])/2} &, 35] (* Michael De Vlieger, Jul 29 2022 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
S. Bujnowski & B. Dubalski (slawb(AT)atr.bydgoszcz.pl), Mar 08 2002
STATUS
approved