Task

Implement the algorithm to compute the principal   nth   root   





A

n





{\displaystyle {\sqrt[{n}]{A}}}

   of a positive real number   A,   as explained at the   Wikipedia page.



nthr(n,r) <= n^(1/r)
 
nthroot(n,r)=
  a = n/r
  g = n
  > g!=a
    g = a
    a = (1/r)*(((r-1)*g)+(n/(g^(r-1))))
  <
  <= a
.
 
#.output(nthr(2,2))
#.output(nthroot(2,2))