Problems

2. PowerOfPrimes

Power of Product of Primes

Find the greatest integer p such that the product of the first k primes raised to power p divides n!(factorial of n, i.e., 1*2*3*4*....*n).

(Note: The first prime is 2, second prime is 3, etc.)

Input Format:

Line 1 : A single integer T, the number of testcases.
This is followed by T test cases.
The ith test case consists of a single line with 2 integers, n_i and k_i in order.

Output Format:

Output consists of T lines.
The ith line contains the greatest integer p such that the pth power of the product of first k_i primes divides n_i! .

Constraints:

1 <= T <= 100
n fits in a 64-bit signed integer(long long).
1 <= k <= 1000

Points:

300

Scoring:

Absolute Score = 1000000 / ( 5*S + 2*C + 10*K + 3*O )
where,
S = Number of semicolons ;
C = Number of non-whitespace characters
K = Number of keywords
O = Number of commas

Allowed header files:

stdio.h

Sample Input:

2 10 3 7 2

Sample Output:

2 2

Time Limit: 1 second

Memory Limit: 64 MB