h(n)
Time limit2sMemory limit512 MB
Given n up to 10^18, find the smallest x with x raised to d(x), its divisor count, equal to n, or -1.
- Level
Medium7 of 10
- Topics
- Number theory, Binary search, Math
- Solved
- No attempts yet
Problem
Seonggwan is studying a function defined on the positive integers.
First, let be the number of distinct positive divisors of .
Then is raised to the power , that is .
For example, , so .
Given an integer , write a program that finds the smallest positive integer with .
Input
The first line contains ().
Output
Print the smallest positive integer with on the first line. If no such exists, print .