zmwangx / miller-rabin

Fast, deterministic* Miller-Rabin primality test for Python
MIT License
6 stars 2 forks source link

Broken Hash Table #5

Open JASory opened 1 year ago

JASory commented 1 year ago

It is known that Bradley Bergs hashtable implementation is broken with over 30K failures, the original author didn't even claim that it was a correct implementation. There are currently only two correct hashtables that have been published. Forisek and Jancina's 3-base test (ignoring that one error) and the more complex implementation in number-theory. I strongly recommend switching to Forisek & Jacina's table as it is the simplest correct hashtable implementation (number-theory is quite a bit faster but relies on 3 different compositeness checks to cover all the cases, while F&J's table is essentially identical to Berg's table in implementation and was infact the precursor) machine-prime is also a correct implementation.