An open API service indexing awesome lists of open source software.

https://github.com/moehmeni/primality-test-c-extension

A Python C extension for primality test using 6k+-1 optimization
https://github.com/moehmeni/primality-test-c-extension

cpython prime-numbers python python-extension

Last synced: about 2 months ago
JSON representation

A Python C extension for primality test using 6k+-1 optimization

Awesome Lists containing this project

README

          

# primality test c extension
A Python module for primality test using [6k+-1 optimization](https://en.wikipedia.org/wiki/Primality_test#Simple_methods) written in C which is almost
37 times faster than the same function written in pure Python

## Installation
```
python setup.py install
```
## Usage
```py
import prime
prime.is_prime(2147483647)
```
You can also run `c_test.py` and `py_test.py` Python programs in the `tests` directory to see the performance difference between pure Python code and this C extension