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.

Showing 1-2 of 2 results.

A123596 Squares alternating with triangular numbers.

Original entry on oeis.org

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

Views

Author

Peter Hansen (babyskbaby(AT)web.de), Nov 14 2006

Keywords

Comments

Rearrangement of A054686.
For n >= 2, a(n) is the number of distinct positive slopes of least squares regression lines fitted to n points (j,y_j), 1 <= j <= n, where all y_j are 0 or 1. The total number of distinct slopes is 2*a(n)+1 (a(n) positive, a(n) negative, and the zero slope). - Pontus von Brömssen, Mar 10 2024

Crossrefs

Programs

  • Magma
    [(3*n^2-1+(n^2+1)*(-1)^n)/16: n in [0..10]]; // G. C. Greubel, Oct 26 2017
  • Mathematica
    CoefficientList[Series[x^2*(1+x+x^2)/((1-x)^3*(1+x)^3), {x, 0, 50}], x] (* or *) Table[(3*n^2-1+(n^2+1)*(-1)^n)/16, {n,0,50}] (* G. C. Greubel, Oct 26 2017 *)
    With[{nn=30},Riffle[Range[0,nn]^2,Accumulate[Range[0,nn]]]] (* or *) LinearRecurrence[{0,3,0,-3,0,1},{0,0,1,1,4,3},60] (* Harvey P. Dale, Feb 11 2020 *)
  • PARI
    {a(n) = if(n%2,(n^2-1)/8,n^2/4)} \\ Michael Somos, Nov 18 2006
    

Formula

a(2*n) = n^2, a(2*n+1) = (n^2+n)/2.
From R. J. Mathar, Feb 12 2010: (Start)
a(n) = 3*a(n-2) - 3*a(n-4) + a(n-6).
G.f.: x^2*(1+x+x^2)/((1-x)^3*(1+x)^3). (End)
a(n) = (3*n^2-1+(n^2+1)*(-1)^n)/16. - Luce ETIENNE, May 30 2015

Extensions

Edited by Michael Somos, and several other correspondents, Nov 14 2005

A267322 Expansion of (1 + x + x^2 + x^4 + 2*x^5)/(1 - x^3)^3.

Original entry on oeis.org

1, 1, 1, 3, 4, 5, 6, 9, 12, 10, 16, 22, 15, 25, 35, 21, 36, 51, 28, 49, 70, 36, 64, 92, 45, 81, 117, 55, 100, 145, 66, 121, 176, 78, 144, 210, 91, 169, 247, 105, 196, 287, 120, 225, 330, 136, 256, 376, 153, 289, 425, 171, 324, 477, 190, 361, 532, 210, 400, 590, 231, 441, 651
Offset: 0

Views

Author

Ilya Gutkovskiy, Apr 07 2016

Keywords

Comments

Triangular numbers alternating with squares and pentagonal numbers.

Examples

			Illustration of initial terms:
==========================================================
n:    0   1   2     3     4     5       6       7       8
----------------------------------------------------------
                                                        o
                                                      o o
                                o       o   o o o   o o o
                    o   o o   o o     o o   o o o   o o o
      o   o   o   o o   o o   o o   o o o   o o o   o o o
==========================================================
      1   1   1     3     4     5       6       9      12
----------------------------------------------------------
		

Crossrefs

Programs

  • Mathematica
    LinearRecurrence[{0, 0, 3, 0, 0, -3, 0, 0, 1}, {1, 1, 1, 3, 4, 5, 6, 9, 12}, 70]
    Table[(Floor[n/3] + 1) ((n + 1) Floor[n/3] - 3 Floor[n/3]^2 + 2)/2, {n, 0, 70}] (* Bruno Berselli, Apr 08 2016 *)
    CoefficientList[Series[(1+x+x^2+x^4+2x^5)/(1-x^3)^3,{x,0,70}],x] (* Harvey P. Dale, Dec 31 2023 *)
  • PARI
    x='x+O('x^99); Vec((1+x+x^2+x^4+2*x^5)/(1-x^3)^3) \\ Altug Alkan, Apr 07 2016

Formula

G.f.: (1 + x + x^2 + x^4 + 2*x^5)/(1 - x^3)^3.
a(n) = 3*a(n-3) - 3*a(n-6) + a(n-9).
a(3k) = A000217(k+1), a(3k+1) = A000290(k+1), a(3k+2) = A000326(k+1).
Sum_{n>=0} 1/a(n) = 2 - Pi/sqrt(3) + Pi^2/6 + 3*log(3) = 5.1269715686...
a(n) = (floor(n/3) + 1)*((n+1)*floor(n/3) - 3*floor(n/3)^2 + 2)/2. - Bruno Berselli, Apr 08 2016
Showing 1-2 of 2 results.