H :: Hip To Be Square
Time Limit: 5 Seconds Memory Limit: 65536 KB
None of the numbers 6, 10, 15 is a square, but their product, the number 900, is a square. We are interested in sets of positive integers, the product of which is a square. We call such a set HIP (this stands for Has Interesting Product). Evidently {6, 10, 15} is HIP, and so is {25}.
More generally, given a set of positive integers, does it have a non-empty subset which is HIP, and if so, for which of the HIP subsets will the product be minimal?
To make things slightly easier for you, we restrict our attention to intervals.
Input
Each test case consists of two integers a and b on a single line (1 < a < b ≤ 4900). These integers describe the interval A = { x ∈ N | a ≤ x ≤ b }.
Output
For each test case, print the least number k such that the product of the elements of some non-empty subset X ⊆ A equals k2 . If no such number exists, print ‘none’. The number k will be less than 263 .
Sample Input
20 30 101 110 2337 2392
Sample Output
5 none 3580746020392020480Submit
Source: NWERC 2012