1

The matrix NxN has N rows and columns. It has all unique elements starting from 1 to (N^2). The condition is the summation of any row elements should be equal to summation of any other row or column elements.

Example: For 3x3 matrix, one of the possible combination looks like following.

4 8 3
2 6 7
9 1 5

Now the question is how many possible combinations can occur to satisfy the given condition of given NxN matrix where N is any odd number?

Thanks for the help in advance.

Patrick

Patrick
  • 11
  • 1

1 Answers1

0

The best available answer is, "A heck of a lot."

If you add the condition "same sum down the diagonal", these are magic squares. As http://oeis.org/A006052 notes, the count of magic squares is known for n = 1, 2, 3, 4, and 5. The exact answer for 6 is not known, but it is in the order of 10**20.

Your counts will be higher still because you lack the diagonal condition. But the computational complexities are the same. Brute force will give you answers for n = 1, 2, 3, and 4 fairly easily. 5 will be doable. 6 will be intractable. 7 will be "no hope".

btilly
  • 43,296
  • 3
  • 59
  • 88