OFFSET
1,2
COMMENTS
Previous name was: A modified variant of A005900.
Let S(x) = (1, 3, 5, 7,...); then A178946 = (1/2) * ((S(x)^2 + S(x^2)).
If n is even, a(n) is the sum of the first n squares minus n^2/2. If n is odd, a(n) is the sum of the first n squares minus n(n-1)/2. - Wesley Ivan Hurt, Sep 17 2013
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (2,1,-4,1,2,-1).
FORMULA
a(n) = +2*a(n-1) +a(n-2) -4*a(n-3) +a(n-4) +2*a(n-5) -a(n-6). G.f.: x*(1+x+4*x^2+x^4+x^3) / ( (1+x)^2*(x-1)^4 ). - R. J. Mathar, Jan 03 2011
EXAMPLE
(1/2) *((1, 6, 19, 44, 85, 146, 231,...) + (1, 0, 3, 0, 5, 0, 7, 0, 9,...)) =
(1, 3, 11, 22, 45, 73, 119,...).
MAPLE
A005900 := proc(n) n*(2*n^2+1)/3 ; end proc:
seq(A178946(n), n=1..60) ; # R. J. Mathar, Jan 03 2011
seq(k*(k+1)*(2*k+1)/6 - k*floor(k/2), k=1..100); # Wesley Ivan Hurt, Sep 17 2013
MATHEMATICA
Table[n(n+1)(2n+1)/6-n*Floor[n/2], {n, 100}] (* Wesley Ivan Hurt, Sep 17 2013 *)
LinearRecurrence[{2, 1, -4, 1, 2, -1}, {1, 3, 11, 22, 45, 73}, 50] (* Harvey P. Dale, Mar 20 2018 *)
PROG
(Magma) [n*(n+1)*(2*n+1)/6 - n*Floor(n/2): n in [1..50]]; // Vincenzo Librandi, Sep 17 2013
CROSSREFS
KEYWORD
nonn
AUTHOR
Gary W. Adamson, Dec 30 2010
EXTENSIONS
Better name using formula from Wesley Ivan Hurt, Joerg Arndt, Sep 17 2013
STATUS
approved