-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU import Control.Applicative import Data.List main = readLn >>= \n -> print $ (!! 1) $ foldl g [n, 1] $ takeWhile (<= n) $ primes [2..] where f (x, c) p | mod x p == 0 = f (div x p, c + 1) p | mod c 2 == 0 = [x, 1] | otherwise = [x, p] g (x:c:_) p = zipWith (*) [1, c] $ f (x, 0) p primes [] = [] primes (x:xs) = x : primes [p | p <- xs, mod p x > 0]