Calculating the mth root of a rational number

We use a discrete form of Newton's method to find \(\lfloor x^{1/m}\rfloor\), the integer part of the mth root of a positive integer x.
(See K.R. Matthews, Computing m-th roots, The College Mathematics Journal 19 (1988) 174-176.
Also see MP313 lecture notes and H. Lüneburg's book On the Rational Normal Form of Endomorphisms 1987, B.I. Wissenschaftsverlag, Mannheim/Wien/Zürich.)
Note that if x=a/b, a > 0, b > 0, is a positive rational, then \(\lfloor x^{1/m}\rfloor=\lfloor\lfloor x\rfloor^{1/m}\rfloor\).
The answer is given truncated to r decimal places.
This is a BCMATH version of a BC function mthrootr(a,b,m,r) contained in the file gcd.

Enter a (≥ 1):
Enter b (≥ 1):
Enter m (100 ≥ m > 1):
Enter r (200 ≥ r ≥ 0):

Last modified 4th January 2014
Return to main page