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
- Host: GitHub
- URL: https://github.com/moehmeni/primality-test-c-extension
- Owner: moehmeni
- Created: 2022-02-21T15:05:12.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-21T18:40:02.000Z (over 4 years ago)
- Last Synced: 2025-10-22T07:25:15.494Z (8 months ago)
- Topics: cpython, prime-numbers, python, python-extension
- Language: C
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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