OFFSET
1,2
COMMENTS
From a quiz.
REFERENCES
A. Wareham, Test Your Brain Power, Ward Lock Ltd (1995).
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (0, 0, 0, 3, 0, 0, 0, -3, 0, 0, 0, 1).
FORMULA
a(n) = n*(3*n-1)/2 if n=1 mod 4 or n*(4*n-2)/2 if n=2 mod 4 or n*(5*n-3)/2 if n=3 mod 4 or n*(6*n-4)/2 if n=0 mod 4
a(n)=3*a(n-4)-3*a(n-8)+a(n-12) for n>11. - Harvey P. Dale, Mar 01 2015
MATHEMATICA
fn[n_]:=Module[{r=Mod[n, 4]}, Which[r==1, (n(3n-1))/2, r==2, (n(4n-2))/2, r==3, (n(5n-3))/2, r==0, (n(6n-4))/2]]; Array[fn, 50] (* or *) LinearRecurrence[ {0, 0, 0, 3, 0, 0, 0, -3, 0, 0, 0, 1}, {1, 6, 18, 40, 35, 66, 112, 176, 117, 190, 286, 408}, 50] (* Harvey P. Dale, Mar 01 2015 *)
PROG
(PARI) for(n=1, 60, m=(n+3)%4; print1(n*((m+3)*n-m-1)/2, ", "))
CROSSREFS
KEYWORD
nonn
AUTHOR
Herman Jamke (hermanjamke(AT)fastmail.fm), Sep 14 2006
STATUS
approved