Re:All Mersenne prime exponents below 100m tested at least once
by linknoid on Friday December 04, 2020 @06:01PM
(#25309480)
The simple trick with modulo 7 is take all the 3 bit sequences: (x & 111), (x & 111000) >> 3, (x & 111000000) >> 6, etc. and add them all together. It means you just have to do bitshift + add instead of all the complexity of division. Same applies to higher powers of 2^n-1 as well.
[ Parent
| on HN ]
Re:All Mersenne prime exponents below 100m tested at least once
by SamReidHughes on Friday December 04, 2020 @06:23PM
(#25309657)
You can also combine those shift/adds by multiplying by a 1001001001 pattern or perhaps some 1000001000001 patterns.