cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A178946 a(n) = n*(n+1)*(2*n+1)/6 - n*floor(n/2).

Original entry on oeis.org

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

Views

Author

Gary W. Adamson, Dec 30 2010

Keywords

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

Examples

			(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,...).
		

Crossrefs

Programs

  • Magma
    [n*(n+1)*(2*n+1)/6 - n*Floor(n/2): n in [1..50]]; // Vincenzo Librandi, Sep 17 2013
  • 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 *)

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

Extensions

Better name using formula from Wesley Ivan Hurt, Joerg Arndt, Sep 17 2013