Code for factorial problem giving runtime error

problem statement
Mike found an interesting problem. In this problem you are given two integers, n and k. You need to find the the maximum value of x, such that, n! % kx = 0.

Input Format
First line contains number of test cases, T. Each test case contains two integers each, n and k.

Constraints
1<=T<=20 1<=n<=10^8 2<=k<=10^8

Output Format
Print the value of x for each test case.

Sample Input
2
5 2
1000 2
Sample Output
3
994
Explanation
In the first test case, n = 5 and k = 2. So, n! = 120. n! % 2^0 = 0, n! % 2^1 = 0, n! % 2^2 = 0, n! % 2^3 = 0, n! % 2^4 = 8, n! % 2^5 = 24, n! % 2^6 = 56, n! % 2^7 = 120. So, the answer should be 3.

my code link

@mehul.narendra.dubey provide the hackerblocks question link or tell the question name

NOW I INCLUDED THE QUESTION INFO IN THIS , PLEASE HAVE A LOOK

@mehul.narendra.dubey i am asking for the question link so that i can submit it and check before telling you anything

i am not getting that question on hacker blocks

A Factorial Problem, in code i have mentioned full question in comment
you can read that

https://hack.codingblocks.com/app/dcb/897

try this link

problem might be removed from there , but in code i mentioned full question in detail

@mehul.narendra.dubey got the problem wait some time checking your code

@mehul.narendra.dubey corrected wrong posn bracket closed


dont forget to hit like and mark resolved if cleared :smiley:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.