Interesting Set
Time limit1sMemory limit128 MB
Given a range [a,b], find the minimum-product square-forming subset using squarefree factorization and linear algebra over GF(2) plus meet-in-the-middle/graph reasoning.
- Level
Hard8 of 10
- Topics
- Number theory, Math, Bit manipulation, Brute force
- Solved
- No attempts yet
Problem
The numbers , , and are not perfect squares, yet their product is a perfect square.
A set of positive integers whose elements multiply to a perfect square is called an interesting set. For example, and are both interesting sets.
The product of all elements of an interesting set is called its value; by definition this value is always a perfect square.
Given a set , write a program that finds the smallest value among all non-empty subsets of that are interesting sets.
Input
The input consists of several test cases. Each test case is a single line containing two integers and with . These two numbers describe the set , where is the set of natural numbers. Process every test case until the end of input.
Output
For each test case, let be the smallest value among all non-empty subsets of that are interesting sets, and print on its own line. If no non-empty subset is an interesting set, print none instead.