10780-again Prime? No time.
Time limit:3.000 seconds
Http://uva.onlinejudge.org/index.php? option=com_onlinejudge&itemid=8&category=467&page=show_problem&problem=17 21
The problem statement is very easy. Given a number n you have to determine the largest power of M., not necessarily prime, that divides n !.
Input
The input file consists of several test cases. The "the" the "the" number of cases to handle. The following lines are the cases each of which contains two integers m (1<m<5000) and N (0<n<100 the integers are separated by a space. There'll is no invalid cases given and There are not more. test Cases.
Output
For the "in" input, print the case number and separate lines. The result is either an integer if m divides n! Or a line "impossible to divide" (without the quotes). Check the sample input and output format.
Sample Input
2
2 10
2 100
Sample Output
Case 1:
8
Case 2:
97