# algorithm – Given a positive integer N, what is the minimum positive integer K such that K! Is a multiple of the square of N?

Pretty new to programming, been doing some pretty basic stuff but I came across a more complicated one now (C language), not sure how to start with it. I’m not understanding the definition of “K! is a multiple of the square of N” to be frank, so I can’t really tell what is expected from me here. If anyone could just explain the point to me, I would really appreciate it.

Given a positive integer N, what is the minimum positive integer K such that K! is a multiple of the square of N?

Note that a is a multiple of b if a=b*k for some integer k.
Moreover, note that for any positive integer M, M! is the product of all positive integers whose value is at most M.

Input:

The first line of input contains T, the number of test cases. The following lines describe the test cases.
Each test case consists of one line containing a single integer N.

Output:

For each test case, print a single integer which is the answer for that test case.

Constraints:
1 <= T <= 200000
1 <= N <= 200000

Sample Input:
5
4
5
7
11
24

Sample Output:
8
10
14
22
48

Thanks a lot in advance for any tips!

Posted on Categories Articles