3
$\begingroup$

Let's say you fill in a 5 by 5 square with the numbers 1, 2, ..., 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?

$\endgroup$
9
  • $\begingroup$ Welcome to Puzzling! Is this a puzzle you created yourself? If not, please add a source (such as a link). We have an attribution policy here and unsourced puzzles will be closed. $\endgroup$
    – bobble
    Mar 3, 2021 at 0:39
  • 1
    $\begingroup$ Hi, yes I did create this puzzle myself, and I am wondering the solution. $\endgroup$
    – user73974
    Mar 3, 2021 at 0:55
  • $\begingroup$ Can you do it with a 3X3? What is unique about the 5X5? Try first to arrange the primes 13, 17, 19, 23 and then move to - (11, 22), (7, 14, 21)... I think you will not be able to get a solution. $\endgroup$
    – Moti
    Mar 3, 2021 at 2:25
  • 1
    $\begingroup$ Also asked on Maths SE. $\endgroup$ Mar 3, 2021 at 15:31
  • 4
    $\begingroup$ This question, which was asked on Math SE, is from an active competition. I don't know what the policy on Puzzling SE is, but on Math SE, such questions are locked until after the end of the competition period. Link: math.meta.stackexchange.com/questions/33257 (see problem 5). $\endgroup$ Mar 8, 2021 at 23:53

1 Answer 1

5
$\begingroup$

The short answer is

Such a grid exists

with an example of

 7 16  6  3 25
 5 13 22 12 24
 9 11 17 14  4
20 18 21 19  1
 8 10  2 15 23

Quick evidence.


The first step is to identify the prime factors in the range of 1 to 25.

  • 13, 17, 19, and 23 appear once each.
  • 11 appears twice (11, 22).
  • 7 appears three times (7, 14, 21).
  • 5 appears 6 times, 3 appears 10 times, and 2 appears 22 times.

If a prime factor appears only once, it must necessarily be on the main diagonal. Similarly, if a prime factor appears exactly twice, the two numbers must be placed at the mirror images of each other (so that if one is on Row X and Col Y, the other is on Row Y and col X).

I initially thought that a prime factor cannot appear an odd number of times outside the main diagonal, but it is false (if at least three copies are available):

\ A .
. \ A
A . \

Anyway, other than large primes, the only prime that appears an odd number of times is 7, so I decided to place it on the main diagonal as well as all the large primes:

 7  .  .  .  .
 . 13  .  .  .
 .  . 17  .  .
 .  .  . 19  .
 .  .  .  . 23

At this point, I jumped to the prime factor 5, which has four numbers that contain 5 once (5 to 20) and one number that contains 5 twice (25). In order to make things easy, let's just write down the exponents of the prime factor in consideration. So the mini-task here is to place four 1's and one 2 so that the sum of the first row equals that of the first column, etc.

(From here, every step involves a varying amount of lucky pattern spotting)

One pattern that works is the following:

 .  .  .  .  2
 1  .  .  .  .
 .  .  .  .  .
 1  .  .  .  .
 .  1  .  1  .

I decided to place 5 and 20 on the first column, and 10 and 15 on the bottom row, in the hopes that scattering the prime factors 2's and 3's will make the later steps easier.

With the same intuition, I placed the remaining 7's (14 and 21) and 11's (11 and 22) near the center (where relatively fewer cells are occupied yet). The current grid is as follows:

 7  .  .  . 25
 5 13 22  .  .
 . 11 17 14  .
20  . 21 19  .
 . 10  . 15 23

Now, I turned the attention to the prime factor 3. Again considering only the exponents of 3, there are six ones (3, 6, 12, 15, 21, 24), and two twos (9, 18). 15 and 21 are already placed on the grid. It took more effort to find a pattern that fits all of these, but after some trial and error with placing two 2's first, I finally found one that works: (parenthesized (1)s are the fixed ones)

 .  .  1  1  .
 .  .  .  1  1
 2  .  .  .  .
 .  2 (1) .  .
 .  .  . (1) .

Intuition again tells me that it'd be better to place 9 on the first column and 18 on the second. I decided to not place other threes yet, but instead fit them together with the remaining numbers according to the powers of 2.

Current grid:

 7  A  B  B 25
 5 13 22  B  B
 9 11 17 14  A
20 18 21 19  A
 A 10  A 15 23

The As are where 1, 2, 4, 8, 16 will be placed, and the Bs are for 3, 6, 12, 24.

Finally, let's focus on the prime factor 2. The exponents of 2 on the current grid look like this:

 0  A  W  X  0
 0  0  1  Y  Z
 0  0  0  1  B
 2  1  0  0  C
 D  1  E  0  0

and the constraint is that we need to place 0 to 4 into A-E and 0 to 3 into W-Z.

Let's try 4 for A. Then Y and Z must contain 2 and 3, and W and X must contain 0 and 1, in some order. By 1st row/column, D = 3. Since B and E cannot be equal, W cannot be zero, so W = 1 and X = 0.

Since B + C + E + 1 + D = (0 + 1 + 2) + 1 + 3 = 7 is odd, Z must be odd too. So Z = 3 and Y = 2.

 0  4  1  0  0
 0  0  1  2  3
 0  0  0  1  B
 2  1  0  0  C
 3  1  E  0  0

4th row/col reveals C = 0, and since B > E by 3rd row/col, B = 2 and E = 1. The resulting grid satisfies all the constraints.

Now we convert these exponents into the original numbers to fill the grid, and the result is the answer at the top.

$\endgroup$
3
  • 1
    $\begingroup$ Nicely and detailed done! $\endgroup$
    – Moti
    Mar 3, 2021 at 4:27
  • $\begingroup$ Thank you! This is great answer. As extension, do you have any insight for n=4? $\endgroup$
    – user73974
    Mar 3, 2021 at 19:49
  • $\begingroup$ Temporarily deleted due to the question being part of an ongoing competition; the answer will be undeleted once the competition ends. $\endgroup$
    – Deusovi
    Mar 12, 2021 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.