There is no need to write a program for this. My decision:
Write down all primes that do not exceed the largest divisible number.
For his 20: 2, 3, 5, 7, 11, 13, 17, 19.
Then, if any of the square root of the primes is not greater than the largest divisible number (in our example - 20), you replace the original prime with its square root.
In this example, 2 * 2> 20, 2 * 2 * 2> 20, 2 * 2 * 2 * 2> 20 , but 2 * 2 * 2 * 2 * 2 <20. 2 * 2 * 2 * 2 = 16, so the new line numbers:
16, 3, 5, 7, 11, 13, 17, 19.
The same goes for 3: 3 * 3> 20, but 3 * 3 * 3 <20. 3 * 3 = 9, so the new number line: 16, 9, 5, 7, 11, 13, 17, 19. 5 * 5> 20, so this is the last line.
Multiply all the numbers in the line and you get the answer: 16 * 9 * 5 * 7 * 11 * 13 * 17 * 19 = 232 792 560