GoalGiven two integers A and B, you have to find the largest power of A that divides B! with no remainder.
You have to find the largest integer value of X such that A^X divides B! where B! = B × (B-1) × (B-2) × … × 2 × 1.
One line containing A and B, separated by a single space.
A single line containing X, the largest power of A that divides B!
2 ≤ A, B ≤ 10^7
A higher resolution is required to access the IDE