Related papers: Counting magic squares in quasi-polynomial time
On the math-fun mailing list (7 May 2013), Neil Sloane asked to calculate the number of $n \times n$ matrices with entries in $\{0,1\}$ which are squares of other such matrices. In this paper we analyze the case that the arithmetic is in…
A \emph{magic square} is an $n \times n$ array of distinct positive integers whose sum along any row, column, or main diagonal is the same number. We compute the number of such squares for $n=4$, as a function of either the magic sum or an…
Given a multiset $S$ of $n$ positive integers and a target integer $t$, the Subset Sum problem asks to determine whether there exists a subset of $S$ that sums up to $t$. The current best deterministic algorithm, by Koiliaris and Xu…
We count mxn non-negative integer matrices (contingency tables) with prescribed row and column sums (margins). For a wide class of smooth margins we establish a computationally efficient asymptotic formula approximating the number of…
Let s,t,m,n be positive integers such that sm=tn. Let M(m,s;n,t) be the number of m x n matrices over {0,1,2,...} with each row summing to s and each column summing to t. Equivalently, M(m,s;n,t) counts 2-way contingency tables of order m x…
We investigate the approximation for computing the sum $a_1+...+a_n$ with an input of a list of nonnegative elements $a_1,..., a_n$. If all elements are in the range $[0,1]$, there is a randomized algorithm that can compute an…
In recreational mathematics, a normal magic square is an $n \times n$ square matrix whose entries are distinctly the integers $1 \ldots n^2$, such that each row, column, and major and minor traces sum to one constant $\mu$. It has been…
A magic square of order n is an nxn square (matrix) whose entries are distinct nonnegative integers such that the sum of the numbers of any row and column is the same number, the magic constant. In this paper we introduce the concept of…
We present a randomized approximation algorithm for counting contingency tables, mxn non-negative integer matrices with given row sums R=(r_1, ..., r_m) and column sums C=(c_1, ..., c_n). We define smooth margins (R,C) in terms of the…
Magic squares are a fascinating mathematical challenge that has intrigued mathematicians for centuries. Given a positive (and possibly large) integer \( n \), one of the main challenges that still remains is to find, within a computational…
Based on the work of Green, Tao and Ziegler, we give asymptotics when $N \to \infty$ for the number of $n \times n$ magic squares with their entries being prime numbers in $[0,N]$. For every $n \ge 3$ we give appropriate systems of linear…
We represent the number of mxn non-negative integer matrices (contingency tables) with prescribed row sums and column sums as the expected value of the permanent of a non-negative random matrix with exponentially distributed entries. We…
A magic labelling of a set system is a labelling of its points by distinct positive integers so that every set of the system has the same sum, the magic sum. Examples are magic squares (the sets are the rows, columns, and diagonals) and…
In the present paper we provide a probabilistic polynomial time algorithm that reduces the complete factorization of any squarefree integer $n$ to counting points on elliptic curves modulo $n$, succeeding with probability $1-\varepsilon$,…
We present a polynomial time algorithm, which solves a nonstandard Variation of the well-known PARTITION-problem: Given positive integers $n, k$ and $t$ such that $t \geq n$ and $k \cdot t = {n+1 \choose 2}$, the algorithm partitions the…
The Sylvester's denumerant \( d(t; \boldsymbol{a}) \) is a quantity that counts the number of nonnegative integer solutions to the equation \( \sum_{i=1}^{N} a_i x_i = t \), where \( \boldsymbol{a} = (a_1, \dots, a_N) \) is a sequence of…
In this paper, an exact algorithm in polynomial time is developed to solve unrestricted binary quadratic programs. The computational complexity is $O\left( n^{\frac{15}{2}}\right) $, although very conservative, it is sufficient to prove…
In the Nonnegative Matrix Factorization (NMF) problem we are given an $n \times m$ nonnegative matrix $M$ and an integer $r > 0$. Our goal is to express $M$ as $A W$ where $A$ and $W$ are nonnegative matrices of size $n \times r$ and $r…
The number of non-negative integer matrices with given row and column sums appears in a variety of problems in mathematics and statistics but no closed-form expression for it is known, so we rely on approximations of various kinds. Here we…
A Latin square of order $n$ is an $n\times n$ matrix in which each row and column contains each of $n$ symbols exactly once. For $\epsilon>0$, we show that with high probability a uniformly random Latin square of order $n$ has no proper…