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

%I #12 Mar 27 2021 03:55:26

%S 3,25,1027,193244

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

%H S. E. Thornton, <a href="http://www.bohemianmatrices.com/cpdb/unstructured/unstructured_0_1_2">Properties of the Bohemian family of n x n matrices with population {0, 1, 2}</a>, Characteristic Polynomial Database.

%o (Python)

%o from itertools import product

%o from sympy.matrices import Matrix

%o def a(n):

%o eigset = set()

%o for e in product([0, 1, 2], repeat=n*n):

%o if n > 1 and e[1] > e[n]: continue

%o M = Matrix([list(e[n*r:n*(r+1)]) for r in range(n)])

%o eigset |= set(eig for eig in M.eigenvals().keys())

%o return len(eigset)

%o print([a(n) for n in range(1, 3)]) # _Michael S. Branicky_, Mar 25 2021

%Y Number of characteristic polynomials is in A272659.

%Y Number of minimal polynomials is in A306783.

%K nonn,more,hard

%O 1,1

%A _Steven E. Thornton_, Mar 10 2019