🚀 pyfastmath is a blazing-fast math utility module for Python, written in C for maximum performance. It includes essential number-theoretic functions like GCD, primality checking, modular exponentiation and many more. Check below for more information about the features.
gcd(a, b)– Compute the Greatest Common Divisor of two integersis_prime(n)– Efficiently check if a number is primemod_exp(base, exp, mod)– Perform Modular Exponentiation: (base^exp) % modlcm(a, b)– Calculate the Lowest Common Multiplicantfactorial(n)– Calculate the factorial of a positive integerncr(n, r)– Calculate the combination of two number(nCr)npr(n, r)– Calculate the permutation of two number(nPr)
After building locally:
pip install .Or after uploading to PyPI:
pip install pyfastmathimport pyfastmath
print(pyfastmath.gcd(48, 18)) # ➝ 6
print(pyfastmath.is_prime(97)) # ➝ True
print(pyfastmath.mod_exp(2, 10, 100)) # ➝ 24
print(pyfastmath.lcm(48, 18)) # ➝ 144
print(pyfastmath.factorial(5)) # ➝ 120
print(pyfastmath.ncr(5,2)) # ➝ 10
print(pyfastmath.npr(5, 2)) # ➝ 20See the full documentation from here Docs
- Python 3.6 or higher
- C compiler (e.g. gcc, clang, MSVC)
python setup.py sdist bdist_wheel
pip install dist/pyfastmath-<version>.whlpip install twine
twine upload dist/*This project is licensed under the MIT License.
See the contribution guidelines guidelines
Built with ❤️ by Gourabananda Datta B.Tech CSE, Ramkrishna Mahato Government Engineering College