Problem: find a 7X7 matrix of distinct cubed integers with identical row and column sums.
Well, I have the following code:
ClearAll[findMat]
findMat =
Module[{csums = ConstantArray[#, 3],
mats = Select[DuplicateFreeQ[Join @@ #] &]@
Subsets[Select[DuplicateFreeQ]@
IntegerPartitions[#, {3}, Range[Ceiling[#^(1/2)]]^2], {3}]},
Join @@ ((Select[Total[#] == csums &]@
Tuples[{{#[[1]]}, Permutations[#[[2]]],
Permutations[#[[3]]]}]) & /@ mats)] &;
solsB = ParallelTable[findMat[n] /. {} -> Nothing, {n, 0, 100000}];
{Total[#[[1, 1]]]} & /@ solsB
And this code solves the described problem for a 3X3 matrix of distinct squared integers with identical row and column sums.
How can I edit my code, such that this problem can be solved for a 7X7 matrix of distinct cubed integers with identical row and column sums?