Problem A
Divisibility of Factors
Input: standard input
Output: standard output
Time Limit: 7 seconds
Memory Limit: 32 MB
Given
two integers N and D, you will have to find how many of
the factors of N! (factorial N)
are divisible by D.
Input
The input file contains several lines of input. Each line contains two integers N (0<=N<= 100) and D(0<|D|<=2^31-1). Input is terminated by a line containing two zeroes. This line should not be processed.
Output
For each line of input produce one line of output. This
line contains a single integer, which denotes of many different factors of N!
are divisible by D.
Sample Input
10
2
9 3
0 0
Sample Output
240
128
Shahriar Manzoor