Simplify radical expression in java
问题 Here is my method so far: public static int[] simplifyRadical(int number) { int[] result = new int[2]; for (int i = 1; i < number / 2; i++) { if ((i % number == 0)) { //IS a factor of the number in the radical } } return result; } The format I'm using is result[0] = number outside radical and result[1] = number inside radical . So far, my method gets all the factors of number (which is the initial UNSIMPLFIED number in the radical). So how can I divide the initial number by the perfect square