AdvancedRating 1900
Trailing Zeros in Any Base
Print the number of zeros at the end of n! when it is written in base b.
Input
Two integers n (≤ 10¹⁸) and b (2 ≤ b ≤ 10¹²).
Output
One integer.
Sample 1
Input
6 9
Output
1
Sample 2
Input
38 11
Output
3
Output appears here