# Arrange the numbers in a 4x4 table

Put these numbers:

2, 3, 4, 5, 6, 9, 10, 12, 15, 18, 20, 25, 30, 45, 50, 75

in a 4x4 square table so the products of all numbers in any given row, column and diagonal are equal.

Note : There are multiple solutions, it is preferred to find the universal rule to discover all the solutions.

• I don't understand. So that the product of any given column equals the column of any given row equals the product of any given diagonal? – user24580 Aug 17 '16 at 22:56
• @DonielF I have edited the question to avoid confusion – Jamal Senjaya Aug 17 '16 at 23:03

For each of the three primes 2,3,5 the exponents when we write our numbers as $2^a3^b5^c$ are seven 0s, six 1s, and three 2s in some order. We can't just handle these completely independently because some ways of combining them yield numbers outside our list. So, first question: what "carpets", as Rosie F puts it, are possible? Every row, column or diagonal must have a sum of 3, which we can readily see means it must be either 0111 or 0012 (in some order). Since we have exactly three 2s to "spend", three rows must be 0012 and one must be 0111. The 2s in those rows must lie in different columns. Ignoring all other constraints, that looks to me like it gives only 1152 possibilities to check. That's too many to be any fun by hand, but a computer can do it almost instantly, and the answer is that there are 48 possibilities. So now there are $48^3$ combinations to try, which is also too many to check by hand but easily few enough for a computer.

Some of the solutions are obtained from one another by rotating or reflecting. There's little value in listing those separately, so my program displays only solutions for which the smallest corner value is the top left one and the TR corner is <= the BL corner. It finds 72 solutions, and here they are (I hope the notation is obvious):

$\begin{bmatrix}2 & 15 & 50 & 18\\ 9& 30& 4& 25\\ 20& 5& 45& 6\\ 75& 12& 3& 10\end{bmatrix} \begin{bmatrix}2 & 15 & 50 & 18\\ 6 & 45 & 5 & 20\\ 75 & 10 & 12 & 3\\ 30 & 4 & 9 & 25 \end{bmatrix}\begin{bmatrix} 2 & 75 & 18 & 10\\ 50 & 12 & 15 & 3\\ 9 & 6 & 25 & 20\\ 30 & 5 & 4 & 45 \end{bmatrix}\begin{bmatrix} 2 & 45 & 10 & 30\\ 18 & 20 & 3 & 25\\ 15 & 6 & 75 & 4\\ 50 & 5 & 12 & 9 \end{bmatrix}$

$\begin{bmatrix} 2 & 45 & 50 & 6\\ 18 & 20 & 15 & 5\\ 25 & 10 & 9 & 12\\ 30 & 3 & 4 & 75 \end{bmatrix}\begin{bmatrix} 6 & 5 & 50 & 18\\ 4 & 30 & 3 & 75\\ 45 & 20 & 15 & 2\\ 25 & 9 & 12 & 10 \end{bmatrix}\begin{bmatrix} 2 & 10 & 45 & 30\\ 15 & 75 & 6 & 4\\ 18 & 3 & 20 & 25\\ 50 & 12 & 5 & 9 \end{bmatrix}\begin{bmatrix} 2 & 18 & 75 & 10\\ 9 & 25 & 6 & 20\\ 50 & 15 & 12 & 3\\ 30 & 4 & 5 & 45 \end{bmatrix}$

$\begin{bmatrix} 2 & 50 & 45 & 6\\ 25 & 9 & 10 & 12\\ 18 & 15 & 20 & 5\\ 30 & 4 & 3 & 75 \end{bmatrix}\begin{bmatrix} 6 & 50 & 5 & 18\\ 45 & 15 & 20 & 2\\ 4 & 3 & 30 & 75\\ 25 & 12 & 9 & 10 \end{bmatrix}\begin{bmatrix} 2 & 50 & 15 & 18\\ 75 & 12 & 10 & 3\\ 6 & 5 & 45 & 20\\ 30 & 9 & 4 & 25 \end{bmatrix}\begin{bmatrix} 2 & 50 & 15 & 18\\ 20 & 45 & 5 & 6\\ 9 & 4 & 30 & 25\\ 75 & 3 & 12 & 10 \end{bmatrix}$

$\begin{bmatrix} 2 & 50 & 18 & 15\\ 25 & 9 & 4 & 30\\ 12 & 10 & 75 & 3\\ 45 & 6 & 5 & 20 \end{bmatrix}\begin{bmatrix} 2 & 18 & 50 & 15\\ 9 & 25 & 4 & 30\\ 20 & 6 & 45 & 5\\ 75 & 10 & 3 & 12 \end{bmatrix}\begin{bmatrix} 2 & 18 & 50 & 15\\ 12 & 75 & 10 & 3\\ 25 & 4 & 9 & 30\\ 45 & 5 & 6 & 20 \end{bmatrix}\begin{bmatrix} 2 & 50 & 18 & 15\\ 20 & 45 & 6 & 5\\ 9 & 4 & 25 & 30\\ 75 & 3 & 10 & 12 \end{bmatrix}$

$\begin{bmatrix} 3 & 50 & 12 & 15\\ 75 & 18 & 10 & 2\\ 4 & 6 & 25 & 45\\ 30 & 5 & 9 & 20 \end{bmatrix}\begin{bmatrix} 5 & 18 & 20 & 15\\ 45 & 50 & 6 & 2\\ 4 & 10 & 9 & 75\\ 30 & 3 & 25 & 12 \end{bmatrix}\begin{bmatrix} 6 & 5 & 75 & 12\\ 9 & 30 & 2 & 50\\ 20 & 45 & 10 & 3\\ 25 & 4 & 18 & 15 \end{bmatrix}\begin{bmatrix} 6 & 45 & 5 & 20\\ 15 & 50 & 18 & 2\\ 12 & 3 & 10 & 75\\ 25 & 4 & 30 & 9 \end{bmatrix}$

$\begin{bmatrix} 4 & 10 & 45 & 15\\ 30 & 75 & 6 & 2\\ 9 & 12 & 5 & 50\\ 25 & 3 & 20 & 18 \end{bmatrix}\begin{bmatrix} 4 & 30 & 9 & 25\\ 50 & 15 & 2 & 18\\ 3 & 12 & 75 & 10\\ 45 & 5 & 20 & 6 \end{bmatrix}\begin{bmatrix} 4 & 30 & 25 & 9\\ 18 & 15 & 2 & 50\\ 5 & 20 & 45 & 6\\ 75 & 3 & 12 & 10 \end{bmatrix}\begin{bmatrix} 3 & 75 & 10 & 12\\ 50 & 18 & 15 & 2\\ 6 & 5 & 20 & 45\\ 30 & 4 & 9 & 25 \end{bmatrix}$

$\begin{bmatrix} 5 & 45 & 6 & 20\\ 18 & 50 & 15 & 2\\ 10 & 3 & 12 & 75\\ 30 & 4 & 25 & 9 \end{bmatrix}\begin{bmatrix} 3 & 12 & 75 & 10\\ 18 & 50 & 15 & 2\\ 25 & 9 & 4 & 30\\ 20 & 5 & 6 & 45 \end{bmatrix}\begin{bmatrix} 5 & 4 & 75 & 18\\ 6 & 30 & 3 & 50\\ 45 & 25 & 12 & 2\\ 20 & 9 & 10 & 15 \end{bmatrix}\begin{bmatrix} 5 & 20 & 45 & 6\\ 50 & 18 & 15 & 2\\ 9 & 25 & 4 & 30\\ 12 & 3 & 10 & 75 \end{bmatrix}$

$\begin{bmatrix} 5 & 9 & 50 & 12\\ 6 & 30 & 2 & 75\\ 20 & 25 & 18 & 3\\ 45 & 4 & 15 & 10 \end{bmatrix}\begin{bmatrix} 3 & 25 & 18 & 20\\ 10 & 30 & 2 & 45\\ 12 & 9 & 50 & 5\\ 75 & 4 & 15 & 6 \end{bmatrix}\begin{bmatrix} 3 & 15 & 20 & 30\\ 10 & 50 & 6 & 9\\ 12 & 2 & 45 & 25\\ 75 & 18 & 5 & 4 \end{bmatrix}\begin{bmatrix} 9 & 15 & 20 & 10\\ 30 & 50 & 6 & 3\\ 4 & 18 & 5 & 75\\ 25 & 2 & 45 & 12 \end{bmatrix}$

$\begin{bmatrix} 9 & 25 & 12 & 10\\ 50 & 2 & 6 & 45\\ 4 & 30 & 75 & 3\\ 15 & 18 & 5 & 20 \end{bmatrix}\begin{bmatrix} 4 & 9 & 75 & 10\\ 18 & 50 & 6 & 5\\ 25 & 30 & 3 & 12\\ 15 & 2 & 20 & 45 \end{bmatrix}\begin{bmatrix} 4 & 25 & 9 & 30\\ 50 & 18 & 2 & 15\\ 3 & 10 & 75 & 12\\ 45 & 6 & 20 & 5 \end{bmatrix}\begin{bmatrix} 4 & 25 & 45 & 6\\ 50 & 18 & 10 & 3\\ 9 & 30 & 5 & 20\\ 15 & 2 & 12 & 75 \end{bmatrix}$

$\begin{bmatrix} 3 & 12 & 50 & 15\\ 4 & 25 & 6 & 45\\ 75 & 10 & 18 & 2\\ 30 & 9 & 5 & 20 \end{bmatrix}\begin{bmatrix} 5 & 20 & 18 & 15\\ 4 & 9 & 10 & 75\\ 45 & 6 & 50 & 2\\ 30 & 25 & 3 & 12 \end{bmatrix}\begin{bmatrix} 6 & 75 & 5 & 12\\ 20 & 10 & 45 & 3\\ 9 & 2 & 30 & 50\\ 25 & 18 & 4 & 15 \end{bmatrix}\begin{bmatrix} 6 & 5 & 45 & 20\\ 12 & 10 & 3 & 75\\ 15 & 18 & 50 & 2\\ 25 & 30 & 4 & 9 \end{bmatrix}$

$\begin{bmatrix} 3 & 75 & 12 & 10\\ 25 & 4 & 9 & 30\\ 18 & 15 & 50 & 2\\ 20 & 6 & 5 & 45 \end{bmatrix}\begin{bmatrix} 5 & 75 & 4 & 18\\ 45 & 12 & 25 & 2\\ 6 & 3 & 30 & 50\\ 20 & 10 & 9 & 15 \end{bmatrix}\begin{bmatrix} 5 & 45 & 20 & 6\\ 9 & 4 & 25 & 30\\ 50 & 15 & 18 & 2\\ 12 & 10 & 3 & 75 \end{bmatrix}\begin{bmatrix} 3 & 10 & 75 & 12\\ 6 & 20 & 5 & 45\\ 50 & 15 & 18 & 2\\ 30 & 9 & 4 & 25 \end{bmatrix}$

$\begin{bmatrix} 5 & 6 & 45 & 20\\ 10 & 12 & 3 & 75\\ 18 & 15 & 50 & 2\\ 30 & 25 & 4 & 9 \end{bmatrix}\begin{bmatrix} 4 & 9 & 30 & 25\\ 3 & 75 & 12 & 10\\ 50 & 2 & 15 & 18\\ 45 & 20 & 5 & 6 \end{bmatrix}\begin{bmatrix} 4 & 45 & 10 & 15\\ 9 & 5 & 12 & 50\\ 30 & 6 & 75 & 2\\ 25 & 20 & 3 & 18 \end{bmatrix}\begin{bmatrix} 4 & 25 & 30 & 9\\ 5 & 45 & 20 & 6\\ 18 & 2 & 15 & 50\\ 75 & 12 & 3 & 10 \end{bmatrix}$

$\begin{bmatrix} 5 & 50 & 9 & 12\\ 20 & 18 & 25 & 3\\ 6 & 2 & 30 & 75\\ 45 & 15 & 4 & 10 \end{bmatrix}\begin{bmatrix} 3 & 18 & 25 & 20\\ 12 & 50 & 9 & 5\\ 10 & 2 & 30 & 45\\ 75 & 15 & 4 & 6 \end{bmatrix}\begin{bmatrix} 3 & 20 & 15 & 30\\ 12 & 45 & 2 & 25\\ 10 & 6 & 50 & 9\\ 75 & 5 & 18 & 4 \end{bmatrix}\begin{bmatrix} 9 & 12 & 25 & 10\\ 4 & 75 & 30 & 3\\ 50 & 6 & 2 & 45\\ 15 & 5 & 18 & 20 \end{bmatrix}$

$\begin{bmatrix} 9 & 20 & 15 & 10\\ 4 & 5 & 18 & 75\\ 30 & 6 & 50 & 3\\ 25 & 45 & 2 & 12 \end{bmatrix}\begin{bmatrix} 4 & 75 & 9 & 10\\ 25 & 3 & 30 & 12\\ 18 & 6 & 50 & 5\\ 15 & 20 & 2 & 45 \end{bmatrix}\begin{bmatrix} 4 & 9 & 25 & 30\\ 3 & 75 & 10 & 12\\ 50 & 2 & 18 & 15\\ 45 & 20 & 6 & 5 \end{bmatrix}\begin{bmatrix} 4 & 45 & 25 & 6\\ 9 & 5 & 30 & 20\\ 50 & 10 & 18 & 3\\ 15 & 12 & 2 & 75 \end{bmatrix}$

$\begin{bmatrix} 4 & 25 & 30 & 9\\ 75 & 3 & 10 & 12\\ 6 & 20 & 45 & 5\\ 15 & 18 & 2 & 50 \end{bmatrix}\begin{bmatrix} 4 & 30 & 25 & 9\\ 6 & 45 & 20 & 5\\ 75 & 10 & 3 & 12\\ 15 & 2 & 18 & 50 \end{bmatrix}\begin{bmatrix} 3 & 75 & 20 & 6\\ 25 & 4 & 15 & 18\\ 12 & 10 & 45 & 5\\ 30 & 9 & 2 & 50 \end{bmatrix}\begin{bmatrix} 5 & 45 & 12 & 10\\ 9 & 4 & 15 & 50\\ 20 & 6 & 75 & 3\\ 30 & 25 & 2 & 18 \end{bmatrix}$

$\begin{bmatrix} 3 & 12 & 75 & 10\\ 4 & 25 & 9 & 30\\ 45 & 6 & 20 & 5\\ 50 & 15 & 2 & 18 \end{bmatrix}\begin{bmatrix} 5 & 20 & 45 & 6\\ 4 & 9 & 25 & 30\\ 75 & 10 & 12 & 3\\ 18 & 15 & 2 & 50 \end{bmatrix}\begin{bmatrix} 2 & 25 & 12 & 45\\ 15 & 30 & 3 & 20\\ 18 & 4 & 75 & 5\\ 50 & 9 & 10 & 6 \end{bmatrix}\begin{bmatrix} 6 & 25 & 20 & 9\\ 45 & 30 & 5 & 4\\ 2 & 12 & 15 & 75\\ 50 & 3 & 18 & 10 \end{bmatrix}$

$\begin{bmatrix} 3 & 75 & 12 & 10\\ 45 & 20 & 6 & 5\\ 4 & 9 & 25 & 30\\ 50 & 2 & 15 & 18 \end{bmatrix}\begin{bmatrix} 5 & 45 & 20 & 6\\ 75 & 12 & 10 & 3\\ 4 & 25 & 9 & 30\\ 18 & 2 & 15 & 50 \end{bmatrix}\begin{bmatrix} 3 & 20 & 75 & 6\\ 12 & 45 & 10 & 5\\ 25 & 15 & 4 & 18\\ 30 & 2 & 9 & 50 \end{bmatrix}\begin{bmatrix} 5 & 12 & 45 & 10\\ 20 & 75 & 6 & 3\\ 9 & 15 & 4 & 50\\ 30 & 2 & 25 & 18 \end{bmatrix}$

$\begin{bmatrix} 6 & 20 & 25 & 9\\ 2 & 15 & 12 & 75\\ 45 & 5 & 30 & 4\\ 50 & 18 & 3 & 10 \end{bmatrix}\begin{bmatrix} 2 & 12 & 25 & 45\\ 18 & 75 & 4 & 5\\ 15 & 3 & 30 & 20\\ 50 & 10 & 9 & 6 \end{bmatrix}\begin{bmatrix} 3 & 75 & 10 & 12\\ 45 & 20 & 5 & 6\\ 4 & 9 & 30 & 25\\ 50 & 2 & 18 & 15 \end{bmatrix}\begin{bmatrix} 3 & 10 & 75 & 12\\ 4 & 30 & 9 & 25\\ 45 & 5 & 20 & 6\\ 50 & 18 & 2 & 15\end{bmatrix}$

(This could be condensed by a further factor of 2 using Rosie's "sides-to-middle" transform.)

I don't see any reason to expect there to be a very much less "mechanical" solution, but perhaps I'm missing something. Jamal Senjaya, do you have reason to think that there is a "universal rule to discover all the solutions" that is simpler and more insightful than just combining possibilities as above?

Part solution:

Multiplying all the numbers together yields $27,000^4$ so each group of 4 numbers must multiply to $(2\cdot 3\cdot 5)^3 = 27,000$.
And each number is composed of factors of the form $a$, $a^2$, $a\cdot b$, $a\cdot b\cdot c$ or $a^2\cdot b$ where $a, b, c \in (2,3,5)$ for all possible permutations yielding the $16$ listed numbers.

Some partial solution thoughts:

If you look at the number of factors in each of the numbers, there are:

• 3 numbers with 1 factor: $2,3,5$
• 6 numbers with 2 factors: $2^2, 3^2, 5^2, 2\cdot3, 2\cdot5, 3\cdot5$
• 7 numbers with 3 factors: $2^2\cdot3,2\cdot3^2, 2^2\cdot5,2\cdot5^2, 3^2\cdot5,3\cdot5^2,2\cdot3\cdot5$

Obviously, each row, column and diagonal has to have 9 factors, so there are two possibilities for the four numbers:

• $1,2,3,3$ (ie one of the numbers has 1 factor, one has 2 factors and two have 3 factors)
• $2,2,2,3$

Since there are only 3 ones, there must be 3 rows of the former and 1 of the latter. Similarly 3 columns of the former and 1 column of the latter.

Here's an example, which also works for the diagonals.

1 2 3 3
2 3 2 2
3 1 3 2
3 3 1 2


I expect it would be rather easy to go through the various combinations of these as the basis for the solutions.

You then need to look for your solutions, so that the products are $2^3\cdot3^3\cdot5^3$. Obviously, if you find a solution, you can swap any pair of the primes (e.g. $2\leftrightarrow3$), and get another solution.

• $6^2$ has $4$ factors, I think you meant $5^2$ – JMP Aug 18 '16 at 1:30
• I must be being dense. Where do I say 6^2? – Dr Xorile Aug 18 '16 at 1:36
• '6 numbers with 2 factors' - you had $6^2$ but I've edited it – JMP Aug 18 '16 at 1:37
• Ah. Thanks for helping me make sense! – Dr Xorile Aug 18 '16 at 1:40

Partial solution:

Dr Xorile is on to a good thing with factors, but I think we need to tackle it a different way.

First, reduce each number to the largest power of $p=2$ that divides it: there are 7 $1$s, 6 $p$s and 3 $p^2$s.

If we set $p=3$ and $p=5$ the results are the same, suggesting that the same arrangement ("carpet") in different rotations or reflections will serve for the different primes.

This carpet has 16 values with a grand product of $p^{12}$ and thus a magic product of $p^3$ (bearing Paul out).

A little bit of non-brute-force puzzling (i.e. guesswork) and I found this carpet for the powers of $p$:

 1110 0021 2100 0102 

A "sides-to middle" transform may be done, resulting in

 0021 0201 1011 2100 

The squareful numbers are $p^2, p^2q$ for ${p,q}\in {2,3,5}$ and we also have $30=2\times 3\times 5$. So in combining three carpets we must avoid $p^2qr$ and $p^2q^2r^x$. So a combo of three rotations of the same carpet produces exactly that in one square, and so is wrong. (We must also avoid putting $1$ into any square.) If the respective carpets for $2, 3, 5$ are indeed congruent to each other, two of them are reflections of each other. Either there's some insight I've missed, or we're down to a tedious enumeration of cases to find out how to combine carpets.

To attack the problem, first write the numbers into its prime factors
2 = 2, 3 = 3, 4 = 2.2, 5 = 5 6 = 2.3, 9 = 3.3, 10 = 2.5, 12 = 2.2.3 15 = 3.5, 18 = 2.3.3, 20 = 2.2.5, 25 = 5.5 30 = 2.3.5, 45 = 3.3.5, 50 = 2.5.5 75 = 3.5.5

So all numbers are consist of 3 prime seed 2,3 and 5
Now replace each seed with 3 symbols, A,B and C
So what we get now is A, B,C,AA,BB,CC,AB,AC,BC,ABB,ACC,BAA,BCC,CAA,CBB, and ABC
There are 12A,12B, and 12C Total symbols, so each line must have 3A,3B and 3C

What we have to do now is

Put A,B,C,AA,BB,CC,AB,AC,BC,ABB,ACC,BAA,BCC,CAA,CBB, and ABC to a 4x4 square table,
so every horizontal, vertical and diagonal line have 3A,3B, and 3C.

If we change Gareth 1st answer with ABC solution,

than replacing ABC with permutation [2,3,5], we can get 6 different answers, one of it is as bellow

[[2, 15, 50, 18], [9, 30, 4, 25], [20, 5, 45, 6], [75, 12, 3, 10]]
to
[[A,BC,ACC,BBA], [BB,ABC,AA,CC], [AAC,C,CBB,AB], [BCC,AAB,B,AC]]

now I change A to 3, B to 2, and C to 5, I get new answer

[[3, 10, 75, 12], [4, 30, 9, 25], [45, 5, 20, 6], [50, 18, 2, 15]]