OFFSET
0,1
COMMENTS
The determinant of a 3 X 3 matrix whose elements are a permutation of the numbers 1..9 cannot exceed 412, so this sequence is finite.
EXAMPLE
a(0) = 123456789 because it is the smallest number that can be formed by concatenating the elements of a 3 X 3 matrix whose determinant is 0 and whose elements are a permutation of the numbers 1..9. The matrix is [1 2 3] [4 5 6] [7 8 9].
MATHEMATICA
a[n_] := a[n] = Module[{mat}, mat = Select[Partition[#, 3] & /@ Permutations[Range[1, 9]], Det[#] == n &]; If[Length[mat] > 0, First[Sort[ToExpression[StringJoin[Riffle[ToString /@ Flatten[#], ""]]] & /@ mat]], 0]];
Monitor[(* Do not use Monitor[] if using Wolfram Cloud, otherwise memory issues may occur *)Table[a[n], {n, 0, 24}], {n, Table[a[m], {m, 0, n - 1}]}] (* Robert P. P. McKone, May 11 2024 *)
PROG
(Python)
from sympy import Matrix
from itertools import permutations
adict = dict()
for p in permutations(range(1, 10)):
v = Matrix(3, 3, p).det()
if v not in adict:
adict[v] = int("".join(map(str, p)))
afull = [adict[v] if v in adict else -1 for v in range(max(adict)+1)]
print(afull) # Michael S. Branicky, May 11 2024
CROSSREFS
KEYWORD
base,fini,nonn,less
AUTHOR
Jean-Marc Rebert, May 11 2024
STATUS
approved