# How to find maximal determinant of a 5×5 or 6×6 matrix using the integers 1 to $n^2$ quickly

This code can only solve the 3 * 3 matrix:

list = Permutations[Range[9], {9}];
matrix = Partition[#, 3] & /@ list;
matrix[[#]] & /@ pos
Det[%[[1]]]


But how to quickly and efficiently find the solution in the case of 5 * 5 or even 6 * 6 matrix.

Click on the link to see a specific statement of this problem.

 Needs["Combinatorica"];
n = 3; n2 = n^2; dMax = 0; mMax = {}; p =
Range[n2]; Do[m = Partition[p, n]; d = Det[m];
If[d > dMax, dMax = d; mMax = m];
p = CombinatoricaNextPermutation[p], {k, n2!}];
{dMax, mMax}


The MaximizeOverPermutations function in this link can't find the exact value of 6 * 6 quickly.

The mathematical method in this article may be beneficial to reduce the amount of calculation:

detM[n_] := n^n (n^2 + 1)/2 ((n^3 + n^2 + n + 1)/12)^((n - 1)/2)
detM[6.]

• Why do you expect to get this "quickly"? There are, factoring out row and column permutations and transposition of the matrix (these change the determinant only by sign), $(6^2)! / 6! / 6! / 2 = 358789859943963365613425393664000000$ different matrices. So as long as nobody comes up with a clever mathematical idea, this has to take very long. Just for comparison: for $3 \times 3$-matrices, there are only $(3^2)!/3!/3!/2 = 5040$ matrices to check Feb 1, 2020 at 7:21
• What makes you believe that it can be found quickly? Also, it is a good habit to cite your source when you copy paste code (ie T.D. Noe from oeis.org/A085000). Feb 1, 2020 at 7:21
• @HenrikSchumacher We can see this article to learn how to estimate the upper bound of the maximum value of this problem mathematically: emis.de/journals/JIPAM/images/064_09_JIPAM/064_09_www.pdf Feb 1, 2020 at 7:46