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.

A158092 Number of solutions to +- 1 +- 2^2 +- 3^2 +- 4^2 +- ... +- n^2 = 0.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 10, 0, 0, 86, 114, 0, 0, 478, 860, 0, 0, 5808, 10838, 0, 0, 55626, 100426, 0, 0, 696164, 1298600, 0, 0, 7826992, 14574366, 0, 0, 100061106, 187392994, 0, 0, 1223587084, 2322159814, 0, 0, 16019866270, 30353305134, 0, 0
Offset: 1

Views

Author

Pietro Majer, Mar 12 2009

Keywords

Comments

Twice A083527.
Number of partitions of the half of the n-th-square-pyramidal number into parts that are distinct square numbers in the range 1 to n^2. Example: a(7)=2 since, squarePyramidal(7)=140 and 70=1+4+16+49=9+25+36. - Hieronymus Fischer, Oct 20 2010
Erdős & Surányi prove that this sequence is unbounded. More generally, there are infinitely many ways to write a given number k as such a sum. - Charles R Greathouse IV, Nov 05 2012
The expansion and integral representation formulas below are due to Andrica & Tomescu. The asymptotic formula is a conjecture; see Andrica & Ionascu. - Jonathan Sondow, Nov 11 2013

Examples

			For n=8 the a(8)=2 solutions are: +1-4-9+16-25+36+49-64=0 and -1+4+9-16+25-36-49+64=0.
		

Crossrefs

Programs

  • Maple
    From Pietro Majer, Mar 15 2009: (Start)
    N:=60: p:=1: a:=[]: for n from 1 to N do p:=expand(p*(x^(n^2)+x^(-n^2))):
    a:=[op(a), coeff(p, x, 0)]: od:a; (End)
    # second Maple program:
    b:= proc(n, i) option remember; local m; m:= (1+(3+2*i)*i)*i/6;
          `if`(n>m, 0, `if`(n=m, 1, b(abs(n-i^2), i-1) +b(n+i^2, i-1)))
        end:
    a:= n-> `if`(irem(n-1, 4)<2, 0, 2*b(n^2, n-1)):
    seq(a(n), n=1..60);  # Alois P. Heinz, Nov 05 2012
  • Mathematica
    b[n_, i_] := b[n, i] = With[{m = (1+(3+2*i)*i)*i/6}, If[n>m, 0, If[n == m, 1, b[ Abs[n-i^2], i-1] + b[n+i^2, i-1]]]]; a[n_] := If[Mod[n-1, 4]<2, 0, 2*b[n^2, n-1]]; Table[a[n], {n, 1, 60}] (* Jean-François Alcover, Mar 13 2015, after Alois P. Heinz *)
  • PARI
    a(n)=2*sum(i=0,2^(n-1)-1,sum(j=1,n-1,(-1)^bittest(i,j-1)*j^2)==n^2) \\ Charles R Greathouse IV, Nov 05 2012
    
  • Python
    from itertools import count, islice
    from collections import Counter
    def A158092_gen(): # generator of terms
        ccount = Counter({0:1})
        for i in count(1):
            bcount = Counter()
            for a in ccount:
                bcount[a+(j:=i**2)] += ccount[a]
                bcount[a-j] += ccount[a]
            ccount = bcount
            yield(ccount[0])
    A158092_list = list(islice(A158092_gen(),20)) # Chai Wah Wu, Jan 29 2024

Formula

Constant term in the expansion of (x + 1/x)(x^4 + 1/x^4)..(x^n^2 + 1/x^n^2).
a(n)=0 for any n == 1 or 2 (mod 4).
Integral representation: a(n)=((2^n)/pi)*int_0^pi prod_{k=1}^n cos(x*k^2) dx
Asymptotic formula: a(n) = (2^n)*sqrt(10/(pi*n^5))*(1+o(1)) as n-->infty; n == -1 or 0 (mod 4).
a(n) = 2 * A083527(n). - T. D. Noe, Mar 12 2009
min{n : a(n) > 0} = A231015(0) = 7. - Jonathan Sondow, Nov 06 2013

Extensions

a(51)-a(56) from R. H. Hardin, Mar 12 2009
Edited by N. J. A. Sloane, Sep 15 2009