login
A178946
a(n) = n*(n+1)*(2*n+1)/6 - n*floor(n/2).
1
1, 3, 11, 22, 45, 73, 119, 172, 249, 335, 451, 578, 741, 917, 1135, 1368, 1649, 1947, 2299, 2670, 3101, 3553, 4071, 4612, 5225, 5863, 6579, 7322, 8149, 9005, 9951, 10928, 12001, 13107, 14315, 15558, 16909, 18297, 19799, 21340, 23001
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
FORMULA
a(2n) = A005900(2n)/2. a(2n+1) = (A005900(2n+1)+2n+1)/2.
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
a(n) = A000330(n+1) - A093353(n), n>0. - Wesley Ivan Hurt, Sep 17 2013
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:
A178946 := proc(n) if type(n, 'even') then A005900(n)/2 ; else (A005900(n)+n)/2 ; end if; 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