pyjacket.ntheory.modulo package
Submodules
pyjacket.ntheory.modulo.modular_arithmetic module
- pyjacket.ntheory.modulo.modular_arithmetic.digits(n: int, base: int = 10) list[int][source]
Obtain the digits of an integer in any number base
- Parameters:
n (int) – number of which to obtain the digits
base (int, optional) – base of number system, by default 10
- Returns:
digits of n
- Return type:
list
- Raises:
ValueError – Number base must be larger than 1 Number should be an integer
Examples
>>> digits(137) [1, 3, 7]
>>> digits(254, 16) [15, 14] # 255 = 15*16 + 14
- pyjacket.ntheory.modulo.modular_arithmetic.gcd_extended(a, b)[source]
Implement the extended euclidian algorithm a*x + b*y = gcd(a, b)
Module contents
- pyjacket.ntheory.modulo.gcd_extended(a, b)[source]
Implement the extended euclidian algorithm a*x + b*y = gcd(a, b)