Skip to content

sethtroisi/prime-gap-verify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prime Gap Verify

Python library to verify prime gaps for prime-gap-project

primegapverify

>>> 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 :(

cd primegapverify
python -m pytest

Uploading

make clean
make all
cd primegapverify
python -m pytest
cd .
pip install .
# Manual Test
python
# Make source distribution
python setup.py sdist
# Make binary wheel
python setup.py sdist bdist_wheel
python -m twine upload dist/*.gz

Primes

Either kimwalisch's excellent primesieve or a hand rolled version based on a Sieve of Eratosthenes.

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

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 mpz_probab_prime_p or OpenPFGW.

TODO

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

About

Tool to verify large prime gaps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published