Non-Powerful Subsets

Let’s define a subset of natural numbers as “non-powerful” if it has no subset so that the sum of its elements is a power. Powers are: N M , for all N and M ≥ 2. Note that 1 is not considered as a power. Given integers a and b our goal is to obtain the first maximal subset with numbers in the interval [a,b] satisfying the above property. The subset X is before than Y if X has at least one element less or equal than every element of Y . If the first value coincides, you must output the solution with lowest second value, and so on. Such a subset is named “maximal” if no more elements can be added to it. Input The input file contains several test cases, one per line. Each test case contains the two integers a and b, 1 ≤ a ≤ b ≤ 1000, as described above. Input is terminated by EOF. Output For each input, you should print a line with the numbers belonging to the subset, sorted and space- delimited. The subset will always contain at least one element. Sample Input 23 3 20 4 28 Sample Output 23 3 7 10 11 5 6 7 17 28