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.

A179297 a(n) = n^2 - (n-1)^2 - (n-2)^2 - ... - 1^2.

Original entry on oeis.org

1, 3, 4, 2, -5, -19, -42, -76, -123, -185, -264, -362, -481, -623, -790, -984, -1207, -1461, -1748, -2070, -2429, -2827, -3266, -3748, -4275, -4849, -5472, -6146, -6873, -7655, -8494, -9392, -10351, -11373, -12460, -13614, -14837, -16131
Offset: 1

Views

Author

Keywords

Examples

			1^2-0=1,
2^2-1=3,
3^2-2^2-1=4,
4^2-3^2-2^2-1=2,
5^2-4^2-3^2-2^2-1=-5,
...
		

Crossrefs

Cf. A173142.

Programs

  • Magma
    I:=[1, 3, 4, 2]; [n le 4 select I[n] else 4*Self(n-1)-6*Self(n-2)+4*Self(n-3)-Self(n-4): n in [1..50]]; // Vincenzo Librandi, Jul 04 2012
  • Mathematica
    f[n_]:=Module[{k=n-1,x=n^2},While[k>0,x-=k^2;k--;];x];lst={};Do[AppendTo[lst,f[n]],{n,5!}];lst
    CoefficientList[Series[-(1+x)*(2*x-1)/(x-1)^4,{x,0,50}],x] (* Vincenzo Librandi, Jul 04 2012 *)
    nn=40;Module[{lst=Range[nn]^2,sublst},Table[sublst=Take[lst,n];Last[ sublst]- Total[Most[sublst]],{n,nn}]] (* or *) LinearRecurrence[ {4,-6,4,-1},{1,3,4,2},40] (* Harvey P. Dale, Jul 11 2012 *)

Formula

G.f.: x*(1+x)*(1-2*x)/(1-x)^4. a(n) = -n*(1-9*n+2*n^2)/6 = 4*a(n-1) -6*a(n-2) +4*a(n-3) -a(n-4). [From R. J. Mathar, Jul 11 2010]
a(0)=1, a(1)=3, a(2)=4, a(3)=2, a(n)=4*a(n-1)-6*a(n-2)+4*a(n-3)-a(n-4) From Harvey P. Dale, Jul 11 2012
a(n) = -(A000330(n) - A000326(n) - A000217(n)), for n > 0. Or by name equals negative of: "Square Pyramidal" - "Pentagonal" - "Triangular". - Richard R. Forberg, Aug 07 2013