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.

A124093 Triangular numbers alternating with squares.

Original entry on oeis.org

0, 0, 1, 1, 3, 4, 6, 9, 10, 16, 15, 25, 21, 36, 28, 49, 36, 64, 45, 81, 55, 100, 66, 121, 78, 144, 91, 169, 105, 196, 120, 225, 136, 256, 153, 289, 171, 324, 190, 361, 210, 400, 231, 441, 253, 484, 276, 529, 300, 576, 325, 625, 351, 676, 378, 729, 406, 784, 435, 841
Offset: 0

Views

Author

N. J. A. Sloane, based on a suggestion from Robert G. Wilson v, Nov 27 2006

Keywords

Crossrefs

Cf. A123596. Rearrangement of A054686.

Programs

  • Maple
    a:=proc(n) if n mod 2 = 0 then n*(n+2)/8 else (n-1)^2/4 fi end: seq(a(n),n=0..70); # Emeric Deutsch, Nov 29 2006
  • Mathematica
    tr=Table[{k(k+1)/2,k^2},{k,0,100}]//Flatten (Seidov)
    With[{nn=30},Riffle[Accumulate[Range[0,nn]],Range[0,nn]^2]] (* Harvey P. Dale, Jul 13 2014 *)
  • PARI
    concat([0,0], Vec(-x^2*(x^3+x+1)/((x-1)^3*(x+1)^3) + O(x^100))) \\ Colin Barker, May 28 2015

Formula

a(n) = n(n+2)/8 if n is even; a(n) = (n-1)^2/4 if n is odd (n>=0). - Emeric Deutsch, Nov 29 2006
a(n) = (3*n^2-2*n+2-(n^2-6*n+2)*(-1)^n)/16. - Luce ETIENNE, May 28 2015
a(n) = 3*a(n-2)-3*a(n-4)+a(n-6) for n>5. - Colin Barker, May 28 2015
G.f.: -x^2*(x^3+x+1) / ((x-1)^3*(x+1)^3). - Colin Barker, May 28 2015

Extensions

More terms from Zak Seidov, Nov 28 2006
More terms from Emeric Deutsch, Nov 29 2006