The factorial of a number , denoted as , is equal to the product of all natural numbers up to and including . For example,
Given two numbers and , what is the smallest value of such that has at least factors of (that is, divides evenly into )?
Input Specification
The standard input contains 10 datasets. Each dataset contains two integers , .
For the first 4 cases, is prime and .
For the first 7 cases, .
Output Specification
For each dataset, output the minimum value of such that has at least factors of .
Sample Input (Five Datasets Shown)
2 2
2 3
3 1
4 2
10 10
Sample Output
4
4
3
6
45
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org
Comments
that's the longest time limit I've ever seen