CS 4440 Wiki:
The PyRoots Module


This module is derived from mpmath by Fredrik Johnson (link), and used under fair-use.

To use it, include from pyroots import * in your Python 3 script.



Function integer_nthroot(y, n)

Returns a tuple containing x = floor(y**(1/n)) and a boolean indicating whether the result is exact (that is, whether x**n == y).

>>> print(integer_nthroot(16,2))
(4, True)

>>> print(integer_nthroot(26,2))
(5, False)

Function integer_to_base64(n)

Converts an arbitrarily-long integer n to a big-endian base64 encoding.

>>> print(integer_to_base64(12345678))
b'vGFO'

Table of Contents: