PROBLEM STATEMENT
Every number has distinct factors. A square-free number is a number which has
no factors other than 1 which are perfect squares.
For example, 36 has factors: 1, 2, 3, 4, 6, 9, 12, 18, 36.
Of these, 4, 9, and 36 are perfect squares, therefore 36 is not squarefree.
Similarly, every number has what is called a square-free portion. The
square-free portion of a number is simply the largest square-free factor of
that number. A number x is a factor of y, if when y is divided by x, the
remainder is 0. In the case of 36,
36 has factors 1, 2, 3, 4, 6, 9, 12, 18, 36 and is not square-free.
18 has factors 1, 2, 3, 6, 9, and 18 and is not square-free.
12 has factors 1, 2, 3, 4, 6, and 12 and is not square-free.
9 has factors 1, 3, 9 and is not square-free.
6 has factors 1, 2, 3, 6 and is square-free.
Thus, the square-free portion of 36 is 6.
DEFINITION
Class name: Squarefree
Method name: squarefree
Parameters: int
Returns: int
The method signature is (make sure it is declared public):
int squarefree(int number);
Given a number, determine what its square-free portion is and return that number.
TopCoder will enforce the following restrictions:
* number will be between 1 and 1000000, inclusive.
Examples:
squarefree(10) returns 10
squarefree(36) returns 6
squarefree(100) returns 10
squarefree(101) returns 101
squarefree(5460) returns 2730