시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
10 초 | 256 MB | 143 | 116 | 73 | 89.024% |
$M = 10^{18} + 31$ is a prime number. $g = 42$ is a primitive root modulo $M$, which means that $g^{1} \bmod M, g^{2} \bmod M, \ldots, g^{M-1} \bmod M$ are all distinct integers from $[1; M)$. Let's define a function $f(x)$ as the smallest positive integer $p$ such that $g^{p} = x \bmod M$. $f$ is a bijection from $[1; M)$ to $[1; M)$.
Let's then define a sequence of numbers as follows:
Given $n$, find $a_{n}$.
The only line of input contains one integer $n$ ($0 \le n \le 10^{6}$).
Print $a_{n}$.
0
960002411612632915
1
836174947389522544
300300
263358264583736303
1000000
300