FACTMULN  Product of factorials (easy)
For n positive integer, let F(n) = 1! × 2! × 3! × 4! × ... × n!, product of factorial(i) for i in [1..n].
Let G(n) = {i in [1..n], such that n divides F(i)}.
It is obvious that n belongs to G(n) that makes it a non empty set.
Input
The first line of input contains an integer
T, the number of test cases.
On each of the next T lines, your are given
an integer n.
Output
For each test case, you have to print min(G(n)).
Example
Input: 3 4 5 6
Output: 3 5 3
Explanation
For test case #1:
F(1) = 1! = 1 , not divisible by 4
F(2) = 1! × 2! = 2 , not divisible by 4
F(3) = 1! × 2! × 3! = 12 , divisible by 4
F(4) = 1! × 2! × 3! × 4! = 288 , divisible by 4
So G(4) = {3, 4}.
Constraints
0 < T < 10^4 0 < n < 10^9
A little kB of Python code can get AC in half the time limit. (Edit 20170211, after the compiler changes.)
Input is not randomly chosen ;) Have fun.
hide comments
Vipul Srivastava:
20161218 14:50:32
Lovely question..!! 

aishik_pyne:
20150919 10:49:45
soln id:15160697


varun bumb:
20150725 23:13:59
Nice problem! 

Sayak Haldar:
20150717 00:11:02
Last edit: 20150717 00:31:14 

:.Mohib.::
20150526 16:46:47
Finally done...!! Awsm problem....!!


Soma:
20150115 09:03:12
@Francky can you please check where my code is giving WA.. my submission ID=13431072


Mayank Poply:
20141228 21:06:09
@Francky  Can u give me a test case for which my code fails?I am getting WA Submission ID  13293486


Francky:
20141122 10:28:27
@Shanmukh : your assert is wrong, you have always 0 < n < 10^9 in the input file. Last edit: 20141122 10:29:55 

:(:
20141122 06:13:48
Range of n is more than 10^9 ... Make your code for entire int range. Got 9 WA's due to unclear range :( . Finally AC :D Last edit: 20141122 08:53:55 

Sandeep Singh:
20140828 23:17:19
Finally solve it , there are some corner(difficult) cases :) Last edit: 20140828 23:18:37 
Added by:  Francky 
Date:  20140301 
Time limit:  1.659s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 
Resource:  Own Problem 