# Dividing the first 10 numbers into two groups with similar product

Can you paint all numbers from 2 to 10 with red and blue colour, such that the product of all red numbers is as close as possible to the product of all blue numbers?

My attempt

Blue: 3,7,9,10 (product = 1890)
Red: 2,4,5,6,8 (product = 1920)
Difference = 30

We can verify this is the best we can do mathematically because

$$1890$$ is the largest number less that $$\sqrt{10!}$$ which has no prime factor bigger than $$10$$. Similarly, $$1920$$ is the smallest number greater than $$\sqrt{10!}$$ which has no prime factor greater than $$10$$. Hence, we cannot possibly get a closer product (this is the nearest case that could possibly work and it does!)

Edit: I just wrote a short program to check this and the following colourings also achieve the same result.

Blue: 4,6,8,10 (product = 1920)
Red: 2,3,5,7,9 (product = 1890)

Blue: 5,6,7,9 (product = 1890)
Red: 2,3,4,8,10 (product = 1920)

and, of course, switching the colouring.

A "systematic" solution. Bit tedious but no guessing no computer required.

The prime factors in 10! are 2,3,5,7. 2 occurs in 2,4,6,8,10 -> 8 times. 3 in 3,6,9 -> 4 times, 5 in 5,10 -> twice, 7 in 7 -> once. We need to split those as evenly as possible. Let LxR = 10! the best split. Let c be the gcd of L,R and l,r the relative prime portions. WLOG 7 divides l. The other factors occur with even multiplicity each in at most one of l,r. Splitting on which of these factors occurs in l we have 8 cases.

Only 4 cases are serious contenders:

case 1: l=7, best r=9
case 2: l=7x4^n=28,112,448,1792, best r=25,81,225,2025
case 3: l=7x9^n=63,567 best r=64,400
case 4: l=7x25=175 best r=144

The remaining cases are easily dismissed:

case 5: l=7x4^nx9^m >= 252 much larger than best r=25
case 6: l=7x4^nx25 >= 700 much larger than best r=81
case 7: l=7x9^nx25 >= 1575 much larger than best r=256
case 8: l=7x4^nx9^mx25, r=1

Closest to 1 ratio is 63:64. Filling in the remaining prime factors adds a factor of c=30 to each side

and we recover @hexomino's result

1890:1920. Possible split 3,7,9,10 : 2,4,5,6,8