Metadata-Version: 2.4
Name: primegapverify
Version: 0.11.9
Summary: Helpful tools for verifying prime gaps
Author-email: Seth Troisi <sethtroisi@google.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/sethtroisi/prime-gap-verify
Project-URL: Repository, https://github.com/sethtroisi/prime-gap-verify.git
Keywords: gmp,gmpy2,prime-gaps
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: C
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: POSIX
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: gmpy2>=2.1.1
Dynamic: license-file

# Prime Gap Verify

Python library to verify prime gaps for
[prime-gap-project](https://github.com/primegap-list-project/prime-gap-list/)

## primegapverify

```python
>>> import primegapverify
>>> primegapverify.sieve(101, 20, 20)
[False, False, True, False, False, True, False, True, True, True, True]

>>> [101 + 2 * i for i, v in enumerate(primegapverify.sieve(101, 100, 20)) if v is False]
[101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199]

>>> import sympy
>>> list(sympy.primerange(100, 101+100+1))
[101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199]
```

## Testing

Maybe this works, I've struggled with relative imports for 4+ hours :(

```bash
cd primegapverify
python -m pytest
```

## Uploading

Requires python `build` library

```bash
make clean
make all
cd primegapverify
python -m pytest
cd ..
pip install .
# Manual Test
python -c 'import primegapverify; print(primegapverify.parse("1* 5# + 2"))'
python
# Make source & wheel distribution
python -m build
# Upload source distribution to pypi
python -m twine upload dist/*.gz
```

## Primes

Either [kimwalisch's](https://github.com/kimwalisch/)
excellent [primesieve](https://github.com/kimwalisch/primesieve)
or a hand rolled version based on a Sieve of Eratosthenes.

to use handrolled prime iterator make with `make DEFINES=-DHANDROLLED`

```bash
sudo apt install libprimesieve-dev

# for gmpy2
sudo apt install libgmp-dev libmpc-dev libmpfr-dev
sudo pip install gmpy2==2.1.0b5
```

## Prime Test

[GMPlib's](https://gmplib.org/)
[`mpz_probab_prime_p`](https://gmplib.org/manual/Number-Theoretic-Functions#Number-Theoretic-Functions)
or [OpenPFGW](https://sourceforge.net/projects/openpfgw/).


## TODO

* [ ] Estimated PRP/s using benchmark & interpolation
* [x] `isPrimeLarge` using pfgw
* [x] Parse string ("123 * 73# / 5# - 1000" to primorial form)
