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

2 lines
93 B
Haskell
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
n `nthRoot` x = fst $ until (uncurry(==)) (\(_,x0) -> (x0,((n-1)*x0+x/x0**(n-1))/n)) (x,x/n)