TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Given an integer n, we are interested in finding the minimum integer m no less than n, such that there exists a strictly increasing sequence n=b_1<...<b_t=m, and the multiple b_1b_2...b_t is a perfect square. Note in case that n is itself a perfect square, we can take m=n so that b_1=n is a perfect square.

Input Format

First line contains an integer T(T<=100) denote the number of test cases. For each test case, there is an integer n(2<=n<=100000) in a single line.

Output Format

For each test case, please output the desired number in a line.

Sample Input 1

4
2
7
8
10

Sample Output 1

6
14
15
18

Hints

When n=2, we can choose m=6 and by multiplying 2*3*6=36 is a perfect square.

Problem Source

Migrated from old NTUJ.

tmt514

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 6000 65536 200