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.

A354272 Irregular triangle read by rows: coefficients of polynomials which are the product of all possible monic Littlewood polynomials of degree n.

Original entry on oeis.org

1, -1, 0, 1, 1, 0, -2, 0, -1, 0, -2, 0, 1, 1, 0, -4, 0, 2, 0, -4, 0, 15, 0, 8, 0, -36, 0, 8, 0, 15, 0, -4, 0, 2, 0, -4, 0, 1, 1, 0, -8, 0, 20, 0, -24, 0, 58, 0, -80, 0, -92, 0, 120, 0, 147, 0, 384, 0, -2108, 0, 880, 0, 3940, 0, -3096, 0, 2288, 0, -2136, 0, -1803, 0, -2136, 0, 2288, 0, -3096, 0, 3940, 0, 880, 0, -2108, 0, 384, 0, 147, 0, 120, 0, -92, 0, -80, 0, 58, 0, -24, 0, 20, 0, -8, 0, 1
Offset: 0

Views

Author

Gleb Ivanov, May 22 2022

Keywords

Examples

			The triangle T(n, k) begins
n\k  1 2  3 4  5 6  7 8 9 10 11 12  13 14 15 16 17 18 19 20 21 22 23 24 25
0:   1
1:  -1 0  1
2:   1 0 -2 0 -1 0 -2 0 1
3:   1 0 -4 0  2 0 -4 0 15 0  8  0 -36  0  8  0 15  0 -4  0  2  0 -4  0  1
...
E.g., row 2: {1,0,-2,0,-1,0,-2,0,1} corresponds to polynomial 1-2x^2-x^4-2x^6+x^8.
Number of terms in each row equals A002064(n).
		

Crossrefs

Cf. A020985, A002064 (row lengths).

Programs

  • PARI
    row(n) = { Vecrev(Vec(prod (k=2^n, 2^(n+1)-1, Pol(apply(d -> if (d, 1, -1), binary(k)))))) } \\ Rémy Sigrist, Jul 21 2022
  • Python
    from itertools import product
    def mult_pol(s1, s2):
        res = [0]*(len(s1)+len(s2)-1)
        for o1,i1 in enumerate(s1):
            for o2,i2 in enumerate(s2):
                res[o1+o2] += i1*i2
        return res
    out = []
    for d in range(0, 5):
        startp = [1,]
        for i in product((1,-1),repeat = d):
            startp = mult_pol(startp, list(i)+[1,])
        out.extend(startp)
    print(out)