codeforces#P1114C. Trailing Loves (or L'oeufs?)
Trailing Loves (or L'oeufs?)
Description
Aki is fond of numbers, especially those with trailing zeros. For example, the number has two trailing zeros. Aki thinks the more trailing zero digits a number has, the prettier it is.
However, Aki believes, that the number of trailing zeros of a number is not static, but depends on the base (radix) it is represented in. Thus, he considers a few scenarios with some numbers and bases. And now, since the numbers he used become quite bizarre, he asks you to help him to calculate the beauty of these numbers.
Given two integers and (in decimal notation), your task is to calculate the number of trailing zero digits in the -ary (in the base/radix of ) representation of (factorial of ).
The only line of the input contains two integers and (, ).
Print an only integer — the number of trailing zero digits in the -ary representation of
Input
The only line of the input contains two integers and (, ).
Output
Print an only integer — the number of trailing zero digits in the -ary representation of
Samples
Note
In the first example, .
In the third and fourth example, .
The representation of the number in the -ary base is if , where are integers and . For example, the number from the first example is represented as since .
You can read more about bases here.