pyfastmath v1.1.1

High-performance math functions in C, wrapped for Python! Lightning-fast computations for your mathematical needs.

Installation

pip install pyfastmath

Features

GCD & LCM

Compute greatest common divisor and least common multiple efficiently

Modular Exponentiation

Fast computation of (base^exp) % mod operations

Prime Checking

Efficiently determine if a number is prime

Combinatorics

Factorial, combinations (nCr), and permutations (nPr)

Usage Example

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

Links