#P4930. Inverse Totient: Finding All x with \(\varphi(x)=n\)

    ID: 18171 Type: Default 1000ms 256MiB

Inverse Totient: Finding All x with \(\varphi(x)=n\)

Inverse Totient: Finding All x with (\varphi(x)=n)

Given a positive integer n, find all positive integers x such that the Euler's totient function \(\varphi(x)\) equals n.

Note: The Euler's totient function \(\varphi(x)\) is defined as the number of positive integers up to x that are relatively prime to x.

If there is no such \(x\), output 0. Otherwise, first output the number of solutions, followed by a line of all solutions in increasing order, separated by spaces.

inputFormat

The input consists of a single integer n (\(1 \leq n \leq \text{some reasonable limit}\)).

outputFormat

If there exists at least one integer \(x\) satisfying \(\varphi(x)=n\), then on the first line output the number of such integers, and on the second line output all these integers in increasing order separated by a single space. If no such integer exists, output a single line containing 0.

sample

1
2

1 2

</p>