# https://yukicoder.me/problems/no/1611 # No.1611 Minimum Multiple with Double Divisors # 素因数分解と約数の個数 # X = (p1 ** m1) * (p2 ** m2) * ... * (pk ** mk) # と素因数分解されたとします. このとき, の正の約数の個数は # (m1 + 1)(m2 + 1)...(mk + 1) です. from collections import defaultdict def prime_factorize(n): # 素因数分解 defaultdict a = defaultdict(int) while n % 2 == 0: a[2] += 1 n //= 2 f = 3 while f * f <= n: if n % f == 0: a[f] += 1 n //= f else: f += 2 if n != 1: a[n] += 1 return a t = int(input()) for _ in range(t): x = int(input()) p = prime_factorize(x) cnt = 1 for i in p.values(): cnt *= (i + 1) for i in range(2, 32): ps = prime_factorize(i) dnt = cnt for k, v in ps.items(): dnt = dnt // (p[k] + 1) * (p[k] + v + 1) if dnt == cnt * 2: print(i * x) break