# 7X7 matrix of distinct cubed integers with identical row and column sums

Problem: find a 7X7 matrix of distinct cubed integers with identical row and column sums.

Well, I have the following code (that came from @kglr from my previous question):

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?

• Crossposted here. – Rohit Namjoshi Apr 20 at 19:42
• @Sumit I tried that and I also add Permutations[#[[4]]],Permutations[#[[5]]],Permutations[#[[6]]],Permutations[#[[7]]] to the Tuples-function, but it took a very very long time to complete the calculation. – Jan Apr 21 at 13:23
• Just curious, can you post a solution that you found ? – yarchik Sep 8 at 19:12