OFFSET
1,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -2, 1).
FORMULA
a(n) = n*(n-1)/2 + b(n) where b repeats the period (1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0) of length 12.
a(n) = +2*a(n-1) -a(n-2) +a(n-12) -2*a(n-13) +a(n-14).
G.f.: -x*(1+2*x^4-x^5+2*x^6+x^7+x^8+2*x^9+2*x^12+2*x^3) / ( (1+x) *(1+x^2) *(1+x+x^2) *(x^2-x+1) *(x^4-x^2+1) *(x-1)^3 ).
MATHEMATICA
LinearRecurrence[{2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -2, 1}, {1, 2, 3, 6, 11, 15, 21, 28, 36, 46, 56, 66, 79, 92}, 60] (* Harvey P. Dale, Nov 29 2013 *)
PROG
(Magma) [ n eq 1 select 1 else n+Min(2*Floor(Self(n-1)/2), 3*Floor(Self(n-1)/3)) : n in [1..60] ]; // Klaus Brockhaus, Dec 03 2010
(Magma) b:=func< n | [1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0][(n mod 12)+1] >; [ n*(n-1)/2+b(n-1): n in [1..60] ]; // Klaus Brockhaus, Dec 03 2010
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Benoit Cloitre, Nov 06 2002
STATUS
approved