This repository contain some mathematicals implementations :
The repo now contain the following dir/files :
-
lib/*.py
: Contains various functions -
Primality.py
: Contains primality stufffermat_witness(n)
Check if n is composite, if yes, then return a fermat_witness (see this article)miller_rabin_primtest(n,k)
Miller-Rabin primality testprime_in_range(a,b)
Find a prime number in a given range (a --> b)is_prime(number)
Check if 'number' is primegetprime(nbits)
Generate a prime number that can be stored in 'nbits' bits.safe_prime(a,b)
Find a safe prime number in a given range [a; b[eratosthene()
Yields the sequence of prime numbers via the Sieve of EratosthenesumPrimes(n)
Return the sum of the first n primeschinese_remainder(n, a)
: Chinese remainder theoremisCircularPrime(n)
Return true if n is a circular primersa_attack_small_primes(pathpubkey, outputname)
Crack a RSA private key if one of n factor is < 1e9rsa_pollard_attack(pathpubkey, outputname)
Crack a RSA private key if one of n factor is < 1e14
-
Arithmetic.py.py
: Contains arithmetic stuffgcd(p, q)
Return the greatest common divisor of p and qextd_pgcd(a, b)
Compute extended gcd of two integers (Extended Euclidean algorithm)linear_congruence(a, b, n)
Resolve linear congruence equationsfib(n)
Return the nth-digit Fibonacci numberrecfibo(n)
Return the nth-digit Fibonacci number (recursive way)
Primality.ml
: Contains primality stuff
Primality.c
: Contains primality stuff
-
Primality.exs
: Contains primality stuffPrimeFinder(n)
Return the n-th prime number
-
Number.exs
: Contains primality stuffpandigital_product()
Sum all products whose multiplicand/multiplier/product identity can be written as a 1...9 pandigital.
TODO : Add links lol