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.

A306792 Number of distinct eigenvalues of n X n matrices with elements {0, 1, 2}.

Original entry on oeis.org

3, 25, 1027, 193244
Offset: 1

Views

Author

Steven E. Thornton, Mar 10 2019

Keywords

Crossrefs

Number of characteristic polynomials is in A272659.
Number of minimal polynomials is in A306783.

Programs

  • Python
    from itertools import product
    from sympy.matrices import Matrix
    def a(n):
      eigset = set()
      for e in product([0, 1, 2], repeat=n*n):
        if n > 1 and e[1] > e[n]: continue
        M = Matrix([list(e[n*r:n*(r+1)]) for r in range(n)])
        eigset |= set(eig for eig in M.eigenvals().keys())
      return len(eigset)
    print([a(n) for n in range(1, 3)]) # Michael S. Branicky, Mar 25 2021