The numbers got too big to be represented in
datatype long.
This is overflow, which produces incorrect results.
Anything that can be done with looping can be done with recursion. So there must be a recursive equivalent of any result-controlled loop. Here is one way to do this:
Recursion is often a natural fit to some types of problems where a preliminary result is repeatedly improved.
Does Newton's method fit the style of repeated improvement?