Celeb Glow
general | April 20, 2026

Fill in a $5 \times 5$ square to make equal products in rows and columns

$\begingroup$

Let's say you fill in a $5 \times 5$ square with $1, 2,\dots, 25$. Is there a way to fill it so that the product of the first row is equal to the product of the first column, the product of the second row is equal to the product of the second column, etc?

What about generalization for a $n \times n$ square filled with $1, 2,\ldots, n^2$?


Edit: Here are some updates on progress. For $n=3$, it is a possibility:

$$\begin{matrix} 5 & 1 & 6\\ 2 & 7 & 4\\ 3 & 8 & 9\end{matrix}$$

I'm not sure how to do $n=4, 5$. I know that if there are $>n$ prime number between $n^2/2$ and $n^2$ then $n$ doesn't work. I do not know how to proceed.

$\endgroup$ 10

2 Answers

$\begingroup$

Here's one solution:$$ \matrix{ 7 & 18 & 14 & 10 & 5 \\ 24 & 13 & 11 & 6 & 15 \\ 21 & 22 & 17 & 12 & 4 \\ 1 & 20 & 9 & 19 & 8 \\ 25 & 3 & 16 & 2 & 23 } $$The row and column products are 88200, 308880, 376992, 27360, and 55200. You can easily modify this by applying an arbitrary permutation to both the rows and the columns, applying another arbitrary permutation to the diagonal entries, and/or taking the transpose.

How I found it: The primes 13, 17, 19, and 23 only appear once each, so they must all go on the diagonal. I made the last diagonal entry 7 because $25!$ equals $7 \cdot 13 \cdot 17 \cdot 19 \cdot 23$ times a square, although I don't think this was actually necessary. (For example, the three multiples of 7 could appear in positions $(1, 2), (2, 3)$, and $(3, 1)$, instead of putting one on the diagonal and the other two symmetrically around it.) Then, by trial and error, I found a way to place the multiples of 5 so that each row and corresponding column are divisible by 5 with the same multiplicity. After this, I placed the 1 and 3 near the bottom left to make the row-product-to-column-product ratios nice, and did the rest by more trial and error.

Update: Here's a solution for the 4x4 version, found by a similar method (but with much less casework):$$ \matrix{ 1 & 9 & 8 & 4 \\ 3 & 5 & 7 & 12 \\ 6 & 14 & 11 & 10 \\ 16 & 2 & 15 & 13 } $$I'll let you attempt the cases $n = 6, 7, 8$, and $10$, which seem to be the only other cases not ruled out by primes between $n^2/2$ and $n^2$.

$\endgroup$ $\begingroup$

Okay.... $\prod_{k=1}^{25} = 2^{24}3^{10}5^6c7^3*11*13*17*19*23$

The odd prime powers must be distributed along the diagonals. For example if $11$ is the $k$th row then the product of the $k$th row is divisible by $11$ so the product of the $k$th column is divisible by $11$ but $11$ is the only cell divisible by $11$ so $11$ must appear in the $k$th row of the $k$th column.

So the $5$ cells in the diagonals must be $11,13,17,19,23$. But where will put the $7, 14,$ and $21$?. If we put $7$ in the $n$th row and $m$th column, $ n \ne m$ , then the $m$th row and the $n$th column will both need multiples of $7$. BUt we only have three such multiples total.

If we put a multiple of $7$ in the $m$th row and $n$ column we have one extra unclaimed one. An if we put it in the $m$th row $j$ column $j\ne m, j\ne n$ the we need a fourth one int the $j$th row.

So not possible.

And the for and

$\endgroup$ 2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy