#P8754. Minimum Multiplier for a Perfect Square
Minimum Multiplier for a Perfect Square
Minimum Multiplier for a Perfect Square
An integer \(a\) is called a perfect square if it can be written as \(a = b^2\) for some integer \(b\). Given a positive integer \(n\), find the smallest positive integer \(x\) such that the product \(n \times x\) is a perfect square.
In other words, you need to compute the minimum \(x\) for which \(n \times x = k^2\) for some integer \(k\). You can think of this as making all the exponents in the prime factorization of \(n \times x\) even. If \(n\) is already a perfect square, then \(x = 1\).
inputFormat
The input consists of a single line containing one positive integer \(n\) (1 \(\leq\) \(n\) \(\leq\) 109).
outputFormat
Output a single integer \(x\), the smallest positive integer such that \(n\times x\) is a perfect square.
sample
1
1