What is the process/algorithm for extracting the nth root of x (x and n are integers)? [duplicate]

They use fast-converging iterative techniques (faster than "guess and check").

See the $n$th root algorithm. The second answer here also mentions some improvements on this algorithm that are actually used in practice (at least for square roots).


The easiest way to find $\sqrt[n]{a}$ for integer $n$ and $a>0$ efficiently is to use the Newton-Raphson approximation to invert the function $f : x \mapsto x^n - a$. But one must be careful with choosing the right starting point, so that the iteration will converge quadratically. Quadratic convergence means that at each step the error becomes approximately a constant times its square, which is equivalent to the error being proportional to $c^{2^k}$ after $k$ steps, for some $c \in (0,1)$.

  Let $x_0$ be such that $x_0 \in \sqrt[n]{a}·[1,1+\frac{1}{4n})$.

  For each natural $k$ from $0$ to $\infty$:

    Let $x_{k+1} = x_k - \dfrac{f(x_k)}{f'(x_k)} = x_k - \dfrac{{x_k}^n-a}{n{x_k}^{n-1}} = \dfrac{(n-1){x_k}^n-a}{n{x_k}^{n-1}}$.

  Then $( x_k : k \in \mathbb{N} )$ converges quadratically to $\sqrt[n]{a}$ uniformly for all $a>0$.

For the general case, see this answer.