Algorithms:
-
Greatest common divisor:
gdc(a, b)
- complexity:
O(log(min(a,b)))
- memory:
O(log(min(a,b)))
- description: computes the greatest common divisor between a and b
- complexity:
-
Modular Exponentiation:
modexp(base, power, mod)
- complexity:
O(log(power))
- memory:
O(log(power))
- description: computes (base^power) % mod
- complexity:
-
Pell's Equation:
pell_solutions(n, k)
- complexity:
O(n^(1/2) log n)
- memory:
O(k)
- desciption: computes a list with the first k solutions of the Pell equation: x^2 - n(y^2) = 1
- complexity:
-
Eratosthenes' Sieve:
sieve(n)
- complexity:
O(n (log log n))
- memory:
O(n)
- description: sieve of eratosthenes to find primes less than n
- complexity:
-
Miller Rabin Primality Test:
miller_rabin(n, k=10)
- complexity:
O(k*(log n)^3)
- memory:
- description: find primes less than n with 4^(-k) probability
- complexity: