#P4195. Discrete Logarithm Problem
Discrete Logarithm Problem
Discrete Logarithm Problem
Given three integers a, p, and b, determine the smallest natural number x such that \( a^x \equiv b \pmod{p} \).
Note: It is guaranteed that a solution exists.
inputFormat
The input consists of three space-separated integers: a, p, and b.
outputFormat
Output a single integer denoting the smallest natural number x satisfying \( a^x \equiv b \pmod{p} \).
sample
2 11 4
2