High-performance math functions in C, wrapped for Python! Lightning-fast computations for your mathematical needs.
pip install pyfastmath
Compute greatest common divisor and least common multiple efficiently
Fast computation of (base^exp) % mod operations
Efficiently determine if a number is prime
Factorial, combinations (nCr), and permutations (nPr)
import pyfastmath as fm
# Greatest Common Divisor
print(fm.gcd(48, 18)) # ➜ 6
# Modular Exponentiation
print(fm.mod_exp(2, 10, 1000)) # ➜ 24
# Prime Number Check
print(fm.is_prime(97)) # ➜ True
# Combinatorics
print(fm.factorial(5)) # ➜ 120
print(fm.nCr(10, 2)) # ➜ 45
print(fm.nPr(10, 2)) # ➜ 90