Skip to content

Faster imsersenne#94

Open
oscardssmith wants to merge 9 commits into
JuliaMath:mainfrom
oscardssmith:fast-mersenne
Open

Faster imsersenne#94
oscardssmith wants to merge 9 commits into
JuliaMath:mainfrom
oscardssmith:fast-mersenne

Conversation

@oscardssmith

Copy link
Copy Markdown
Member

Use trial division and pohlard's P-1 algorithm to speed up ismersenne when false. Based roughly on https://www.mersenne.org/various/math.php. The basic idea is that since almost no mersenne numbers are prime, it's worth doing some quick tests before going to LL.
For example, on ismersenne(big(2)^132049-1) this adds about 2.5 seconds of extra checks (compared to 80 seconds original runtime). However, these checks make the algorithm run in only the 2.5 seconds for the vast majority of outputs.

@oscardssmith

oscardssmith commented Feb 28, 2021

Copy link
Copy Markdown
Member Author

I've also realized that using mod_mersenne in ll_primecheck gives a 3.5x speedup for the function in the true case.

@oscardssmith

Copy link
Copy Markdown
Member Author

Any ideas why the 32 bit tests are timing out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant