Square Function
Time limit2sMemory limit256 MB
Given y, find every x whose S(x) equals y, where S(x) is the smallest last element of an increasing chain from x with a square product.
- Level
Medium7 of 10
- Topics
- Number theory, Math, Implementation
- Solved
- No attempts yet
Problem
Let be defined as follows. is the smallest number for which there exists an increasing sequence of integers such that the product is a perfect square. For example, , , and .
Given , find all such that .
Input
The only line contains a single integer ().
Output
On the first line, print the number of solutions. On the second line, print all solutions in increasing order, separated by spaces.
Hint
is the set of positive integers.