#P4780. Phi 的反函数

    ID: 3738 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>搜索枚举,暴力素数判断,质数,筛法

Phi 的反函数

Description

Find the smallest positive integer xx such that φ(x)=n\varphi(x)=n.

Input Format

Input a positive integer nn (n<231n<2^{31}).

Output Format

Output xx. If x>231x>2^{31} or it does not exist, output 1-1.

4
5

Hint

Translated by ChatGPT 5