OFFSET
0,2
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}]
CROSSREFS
KEYWORD
nonn,more,hard
AUTHOR
Robert P. P. McKone, Dec 07 2023
STATUS
approved