Problem Statement
Return the smallest positive integer that has exactly k divisors. If this number is greater than 1018, return -1 instead.
Definition
- Class:
- NumberOfDivisors
- Method:
- smallestNumber
- Parameters:
- int
- Returns:
- long
- Method signature:
- long smallestNumber(int k)
- (be sure your method is public)
Constraints
- k will be between 1 and 50000, inclusive.
Examples
1
Returns: 1
2
Returns: 2
6
Returns: 12
The 6 divisors of 12 are: 1, 2, 3, 4, 6, 12.