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.

A367051 Number of n X n matrices with elements {0, 1} whose characteristic polynomial has coefficients in {-1,0,1}.

This page as a plain text file.
%I A367051 #27 Nov 18 2023 08:08:53
%S A367051 1,2,12,216,10143,1128450,279687570,149055294640
%N A367051 Number of n X n matrices with elements {0, 1} whose characteristic polynomial has coefficients in {-1,0,1}.
%H A367051 Wikipedia, <a href="https://en.wikipedia.org/wiki/Faddeev-LeVerrier_algorithm">Faddeev-LeVerrier algorithm</a>
%H A367051 Wikipedia, <a href="https://en.wikipedia.org/wiki/Intrinsic_function#C_and_C++">Intrinsic Function</a>
%e A367051 The a(2) = 12 2 X 2 matrices are:
%e A367051   [0 0]  [0 0]  [0 1]  [0 1]  [0 1]  [1 1]
%e A367051   [0 0], [1 0], [0 0], [1 0], [1 1], [1 0],
%e A367051 along with
%e A367051   [0 0]  [0 0]  [0 1]  [1 0]  [1 0]      [1 1]
%e A367051   [0 1], [1 1], [0 1], [0 0], [1 0], and [0 0].
%e A367051 These have characteristic polynomials of
%e A367051 x^2, x^2, x^2, x^2-1, x^2-x-1, x^2-x-1,
%e A367051 along with
%e A367051 x^2-x, x^2-x, x^2-x, x^2-x, x^2-x, and x^2-x respectively.
%t A367051 a[0] := 1;
%t A367051 a[n_] := Length[Select[
%t A367051   Tuples[{0, 1}, {n, n}],
%t A367051   Max[Abs[CoefficientList[CharacteristicPolynomial[#, x], x]]] == 1 &
%t A367051 ]]
%o A367051 (Python)
%o A367051 from itertools import product
%o A367051 from sympy import Matrix
%o A367051 def A367051(n): return sum(1 for p in product((0,1),repeat=n**2) if all(d==0 or d==-1 or d==1 for d in Matrix(n,n,p).charpoly().as_list())) if n else 1 # _Chai Wah Wu_, Nov 05 2023
%Y A367051 Cf. A272661, A367052.
%K A367051 nonn,hard,more
%O A367051 0,2
%A A367051 _Peter Kagey_, Nov 03 2023
%E A367051 a(5)-a(6), using the Faddeev-LeVerrier algorithm, from _Martin Ehrenstein_, Nov 06 2023
%E A367051 a(7), using AVX2 Intrinsics, from _Martin Ehrenstein_, Nov 18 2023