Hide
Problem F
Factorial Power
Given integers $n$ and $m$, determine the largest $k$ for which $n^ k$ divides $m! = 1 \cdot 2 \cdots (m - 1) \cdot m$.
Input
The first and only line of input contains the integers $n$ and $m$ ($2 \le n, m \le 10^{14}$).
Output
Output the integer $k$ from the task description.
Sample Input 1 | Sample Output 1 |
---|---|
6 3 |
1 |
Sample Input 2 | Sample Output 2 |
---|---|
123 123123123 |
3078076 |