In case you aren't aware of it, Java doesn't have an exponentiation operator. People often say "x^2/3" as a shorthand, but using standard Java they mean something like a call to Math.pow(). ^ really means something quite different in Java.
(Also note that the 2/3 root is 2/3, not 3/2)
(A) The 2/3 root of a number is the cube root of the square of that number.
Think about positive numbers as a simplification that might serve as starting point.
(B) The 2/3 root of zero is zero and the 2/3 root grows as the number whose root is being found grows. What I mean is that big numbers have big 2/3 roots and small numbers have small 2/3 roots.
This suggests we might find a 2/3 root by playing 20 questions. (or rather, n questions where
n is the limit in the for loop you are supposed to use.)
make a bigGuess
and a littleGuess
LOOP:
is (bigGuess+littleGuess)/2 too big? If so make bigGuess=(bigGuess+littleGuess)/2
is (bigGuess+littleGuess)/2 too small? If so make littleGuess=(bigGuess+littleGuess)/2
The initial guesses could take advantage of the fact that (C) for numbers bigger than 1 the 2/3 root is less than the number, while for numbers less than 1 the 2/3 root is bigger than the number.
-----
Newton and
Halley both came up with iterative methods. But the problem of doubling a cube is much older with geometric (Greek) and iterative approximations (Indian) going back to c400BCE.