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.

Showing 1-2 of 2 results.

A366448 Number of distinct characteristic polynomials for 2 X 2 matrices with entries from {0, 1, ..., n}.

Original entry on oeis.org

1, 6, 22, 58, 116, 221, 356, 573, 824, 1163, 1565, 2143, 2697, 3527, 4385, 5388, 6455, 7992, 9342, 11262, 12953, 15034, 17301, 20246, 22595, 25823, 29054, 32679, 36228, 41112, 44964, 50600, 55288, 60770, 66543, 72927, 78173, 86577, 93925, 101775, 108798
Offset: 0

Views

Author

Robert P. P. McKone, Oct 10 2023

Keywords

Examples

			For n = 1 the a(1) = 6 characteristic polynomials are {x^2, -4 + x^2, -2 + x^2, -1 + x^2, -4*x + x^2, 2-4*x + x^2}.
		

Crossrefs

Cf. A366551 (3 X 3 matrices), A367978 (4 X 4 matrices).
Cf. A058331 (determinants), A005408 (traces).

Programs

  • Mathematica
    mat[n_Integer?Positive]:=mat[n]=Array[m,{n,n}]; flatMat[n_Integer?Positive]:=flatMat[n]=Flatten[mat[n]]; charPolyMat[n_Integer?Positive]:=charPolyMat[n]=FullSimplify[CoefficientList[Expand[CharacteristicPolynomial[mat[n],x]],x]]; a[d_Integer?Positive,0]=1; a[d_Integer?Positive,n_Integer?Positive]:=a[d,n]=Length[DeleteDuplicates[Flatten[Table[Evaluate[charPolyMat[d]],##]&@@Table[{flatMat[d][[i]],0,n},{i,1,d^2}],3]]]; Table[a[2,n],{n,0,41}]
  • PARI
    a(n) = my(list=List()); for (i=0, n, for (j=0, n, for(k=0, n, for(m=0, n, my(p=charpoly([i,j;k,m])); listput(list, p))))); #Set(list); \\ Michel Marcus, Oct 11 2023
    
  • Python
    def A366448(n): return len({(a+d,a*d-b*c) for a in range(n+1) for b in range(n+1) for c in range(b+1) for d in range(a+1)}) # Chai Wah Wu, Oct 12 2023

Formula

a(n) <= A058331(n) * A005408(n) = 4*n^3 + 2*n^2 + 2*n + 1.
A058331(n) = 2*n^2 + 1 <= a(n). - Charles R Greathouse IV, May 08 2025

A367978 Number of distinct characteristic polynomials for 4 X 4 matrices with entries from {0, 1, ..., n}.

Original entry on oeis.org

1, 333, 58335, 2875405, 47125558
Offset: 0

Views

Author

Robert P. P. McKone, Dec 07 2023

Keywords

Crossrefs

Cf. A366448 (2 X 2 matrices), A366551 (3 X 3 matrices).
Cf. A272659.

Programs

  • Mathematica
    mat[n_Integer?Positive] := mat[n] = Array[m, {n, n}];
    flatMat[n_Integer?Positive] := flatMat[n] = Flatten[mat[n]];
    charPolyMat[n_Integer?Positive] := charPolyMat[n] = FullSimplify[CoefficientList[Expand[CharacteristicPolynomial[mat[n], x]], x]];
    a[d_Integer?Positive, 0] = 1; a[d_Integer?Positive, n_Integer?Positive] := a[d, n] = Length[DeleteDuplicates[Flatten[Table[Evaluate[charPolyMat[d]], ##] & @@ Table[{flatMat[d][[i]], 0, n}, {i, 1, d^2}], d^2 - 1]]];
    Table[a[4, n], {n, 0, 2}]
  • Sage
    import itertools
    def a(n):
        ans, W = set(), itertools.product(range(n+1), repeat=16)
        for w in W: ans.add(Matrix(ZZ, 4, 4, w).charpoly())
        return len(ans)  # Robin Visser, May 04 2025

Extensions

a(4) from Robin Visser, May 04 2025
Showing 1-2 of 2 results.