RosettaCodeData/Task/Nth-root/Haskell/nth-root-1.hs

2 lines
93 B
Haskell

n `nthRoot` x = fst $ until (uncurry(==)) (\(_,x0) -> (x0,((n-1)*x0+x/x0**(n-1))/n)) (x,x/n)