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.

A158380 Number of solutions to +-1 +- 3 +- 6 +- ... +- n(n+1)/2 = 0.

Original entry on oeis.org

1, 0, 0, 0, 2, 0, 2, 2, 4, 0, 12, 16, 26, 0, 66, 104, 210, 0, 620, 970, 1748, 0, 5948, 10480, 18976, 0, 60836, 111430, 209460, 0, 704934, 1284836, 2387758, 0, 8331820, 15525814, 28987902, 0, 101242982, 190267598, 358969426, 0, 1275032260, 2404124188, 4547419694
Offset: 0

Views

Author

Pietro Majer, Mar 17 2009

Keywords

Comments

Equivalently, number of partitions of the set of the first n triangular numbers {t(1),...,t(n)} into two classes with equal sums.
Constant term in the expansion of (x + 1/x)(x^3 + 1/x^3)...(x^t(n) + 1/x^t(n)).
a(n) = 0 for all n == 1 (mod 4).
Andrica & Tomescu give a more general integral formula than the one below. - Jonathan Sondow, Nov 11 2013

Examples

			For n=6 the 2 solutions are +1-3+6-10-15+21 = 0 and -1+3-6+10+15-21 = 0.
		

Crossrefs

Programs

  • Maple
    N:=70: p:=1: a:=[]: for n from 0 to N do
    p:=expand(p*(x^(n*(n+1)/2)+x^(-n*(n+1)/2))):
    a:=[op(a), coeff(p, x, 0)]: od:a;
    # second Maple program:
    b:= proc(n, i) option remember; (m-> `if`(n>m, 0,
          `if`(n=m, 1, b(abs(n-i*(i+1)/2), i-1)+
          b(n+i*(i+1)/2, i-1))))((2+(3+i)*i)*i/6)
        end:
    a:= n-> `if`(irem(n, 4)=1, 0, b(0, n)):
    seq(a(n), n=0..50);  # Alois P. Heinz, Sep 17 2017
  • Mathematica
    a[n_] := With[{t = Table[k(k+1)/2, {k, 1, n}]}, Coefficient[Times @@ (x^t + 1/x^t), x, 0]];
    Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 0, 50}] (* Jean-François Alcover, Jun 16 2018 *)
  • PARI
    t(k) = k*(k+1)/2;
    a(n) = polcoeff(prod(k=1, n, (x^t(k)+ 1/x^t(k))), 0); \\ Michel Marcus, May 19 2015

Formula

a(n) = (2^n/Pi) * Integral_{x=0..Pi} cos(x)*cos(3x)*...*cos(n(n+1)x/2) dx.
a(n) ~ 2^(n+1)*sqrt(10/Pi)*n^(-5/2)*(1+o(1)) as n --> infinity, n !== 1 (mod 4).
a(n) = 2 * A058498(n) for n > 0. - Alois P. Heinz, Nov 01 2011

Extensions

a(0) = 1 prepended by Joerg Arndt, Sep 17 2017
Example corrected by Ilya Gutkovskiy, Feb 02 2022