Skip to content

YUX/Lucas-Lehmer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Lucas-Lehmer

An implementation of the Lucas-Lehmer primality test in go (with a few optimizations).

Optimizations

  • For all Mersenne primes (of the form 2p-1) p has to be a prime number, so before doing the more costly Lucas-lehmer test we make sure p is prime.
  • The modulus in the Lucas-Lehmer test is made a lot faster in the fastMod function which uses bitwise operators instead of division, moving the slowest part of the test to the multiplication of s*s.

Further Optimizations

  • replace import "math/big" with import big "github.com/ncw/gmp" ends up 8+ times speedup.
  • log to file
  • use the built-in func (*Int) ProbablyPrime

About

An optimized Lucas-Lehmer primality test

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%