A packaging engineer wants a box count n that can be arranged into exactly k distinct rectangular grid layouts (each divisor pair of n gives one layout), i.e. n must have exactly k positive divisors. Among all such n, she wants the SMALLEST one.
Given k, output the smallest positive integer n such that n has exactly k positive divisors (including 1 and n itself).
Line 1: a single integer k.
A single integer: the smallest positive integer with exactly k divisors.
Example 1
Input
4
Expected
6
Explanation
6 has divisors 1,2,3,6 (4 of them), and no smaller number has exactly 4 divisors, so the answer is 6.
Example 2
Input
1
Expected
1
Explanation
Only n=1 has exactly 1 divisor.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →