TopcoderArchive
SRM9 Oct 2007
SRM 370

NumberOfDivisors

Problem statement, definition, constraints, and public examples.

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. 1
    Returns: 1
  2. 2
    Returns: 2
  3. 6
    Returns: 12
    The 6 divisors of 12 are: 1, 2, 3, 4, 6, 12.
Back to all problems