Multiple of a Squared Factorial
Time limit3sMemory limit512 MB
For many queries N, find the smallest K such that K! is divisible by (N!)^2. The answer is always between N and 2N, and needs Legendre exponent checks.
- Level
Hard8 of 10
- Topics
- Number theory, Math, Binary search, Implementation
- Solved
- No attempts yet
Problem
Given a positive integer , find the smallest positive integer such that is a multiple of .
An integer is a multiple of when holds for some integer . For a positive integer , is the product of all positive integers that are at most .
Input
The first line contains , the number of test cases. Each of the next lines contains one integer .
Constraints
Output
For each test case, print the answer on its own line.