Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 1.15 KB

README.md

File metadata and controls

32 lines (22 loc) · 1.15 KB

Modular_Arithmetic_Python

Description

A library for number theory and modular arithmetic algorithms in Python e.g. Pollard Rho, Miller–Rabin primality test, Cipolla, etc. A couple of implementations where inspired by Wikipedia's pseudocode.

Algorithms:

Miller test (deterministic, not pseudoprimality) - es_primo:

· Checks wether a number is prime or not.

Sieve of Eratosthenes - lista_primos:

· Returns all prime numbers within a specified interval.

Pollard Rho - factorizar:

· Factorise any given number

Extended Euclidean algorithm - mcd

· Calculates the greates common divisor of two numbers. There is another function, "mcd_n", for more than 2 numbers.

Bézout's lemma - bezout

· Returns the Bézout coefficients given a diophantine equation.

Euler's totient function

· Counts the positive integers up to a given integer.

Chinese remainder theorem

· Gives a unique solution to simultaneous linear congruences with coprime moduli.

Cipolla algorithm

· Solves equations of this type: x^2 = n (mod p)

More information

It is possible to find more documentation in the code comments and docstrings.