ECOO '18 R2 P3 - Factorial

View as PDF

Points: 12 (partial)
Time limit: 30.0s
Memory limit: 256M

Problem type

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 Specifications

The standard input will contain 10 datasets. Each dataset contains two integers , .

For the first 4 cases, is prime and .

For the first 7 cases, .

Output Specifications

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