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

2 lines
93 B
Haskell
Raw Permalink Normal View History

2013-04-10 23:57:08 -07:00
n `nthRoot` x = fst $ until (uncurry(==)) (\(_,x0) -> (x0,((n-1)*x0+x/x0**(n-1))/n)) (x,x/n)