Counting magic squares in quasi-polynomial time
Alexander Barvinok, Alex Samorodnitsky, and Alexander Yong

TL;DR
This paper introduces a randomized algorithm that efficiently approximates the count of n x n non-negative integer matrices with fixed row and column sums, achieving quasi-polynomial time complexity.
Contribution
The paper presents a novel randomized algorithm for counting magic squares with quasi-polynomial time complexity, including an implementation and experimental results.
Findings
Algorithm computes magic square counts within relative error epsilon.
Implementation demonstrates practical feasibility of the approach.
Discusses conjectures and potential generalizations.
Abstract
We present a randomized algorithm, which, given positive integers n and t and a real number 0< epsilon <1, computes the number Sigma(n, t) of n x n non-negative integer matrices (magic squares) with the row and column sums equal to t within relative error epsilon. The computational complexity of the algorithm is polynomial in 1/epsilon and quasi-polynomial in N=nt, that is, of the order N^{log N}. A simplified version of the algorithm works in time polynomial in 1/epsilon and N and estimates Sigma(n,t) within a factor of N^{log N}. This simplified version has been implemented. We present results of the implementation, state some conjectures, and discuss possible generalizations.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsMarkov Chains and Monte Carlo Methods · Advanced Combinatorial Mathematics · Topological and Geometric Data Analysis
