TopcoderArchive
Archive
Algorithm problem

PowerfulNumbers

Problem statement, definition, constraints, and public examples.

Problem Statement

In this problem you are to find the smallest number, N, such that for each element p of powers, there is some distinct integer k > 1 such that kp is a factor of N. That is, N%(kp) == 0 using a different value of k for each element of powers.

Definition

Class:
PowerfulNumbers
Method:
smallest
Parameters:
int[]
Returns:
long
Method signature:
long smallest(int[] powers)
(be sure your method is public)

Constraints

  • power will contain between 1 and 10 elements greater than 1, inclusive.
  • The return value will fit in a long.

Examples

  1. {2,2,2}
    Returns: 36
    22, 32, and 62 are all factors of 36.
  2. {2,3,4}
    Returns: 64
  3. {2,3,4,4,4}
    Returns: 4096
Back to all problems