1
\$\begingroup\$

I am working on a code to print all semimagic squares [1] of a given size. I am working with the following definition:

  1. An \$n\times n\$ consists of numbers \$1,2,\cdots, n^2\$.
  2. All numbers must be distinct.
  3. Sum of each row and each column is equal.

According to Ripatti A. (2018) [1]:

\$n\$ number of semimagic squares
1 1
2 0
3 9
4 68 688
5 579 043 051 200
6 94 590 660 245 399 996 601 600
\$\cdots\$ \$\cdots\$

If someone knows of any resources that could help me, please let me know.

References

1. Ripatti A. (2018) On the number of semi-magic squares of order 6. arXiv. 10.48550/arXiv.1807.02983

\$\endgroup\$
2
  • 3
    \$\begingroup\$ Welcome to Code Golf! This site is for competitive programming challenges, not for questions about coding/mathematics. However, you could make this on-topic by making it into a code-golf challenge (given \$n\$, output the number of \$n \times n\$ semi-magic squares), although I'm uncertain how much help that would be to you, given the apparent aim of the question \$\endgroup\$ Commented Jun 10, 2023 at 19:21
  • 1
    \$\begingroup\$ This is A271103 (which itself has a reference to Artem Ripatti). \$\endgroup\$
    – Arnauld
    Commented Jun 12, 2023 at 12:29

0

Browse other questions tagged or ask your own question.