Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative Polynomial Testing (performance improvement) #3

Open
Vadimuh opened this issue Apr 5, 2022 · 3 comments
Open

Alternative Polynomial Testing (performance improvement) #3

Vadimuh opened this issue Apr 5, 2022 · 3 comments

Comments

@Vadimuh
Copy link

Vadimuh commented Apr 5, 2022

https://pastebin.com/uemgwKhN

@hayguen hayguen changed the title Alternative Polynomial Testing Implementation Alternative Polynomial Testing (perfomance improvement) Apr 5, 2022
@hayguen
Copy link
Owner

hayguen commented Apr 5, 2022

example code is java .. and needs to be converted to C++ ..

@Vadimuh Vadimuh changed the title Alternative Polynomial Testing (perfomance improvement) Alternative Polynomial Testing (performance improvement) Apr 5, 2022
@martin-zs
Copy link

martin-zs commented Sep 28, 2023

I think the core idea is to use this precomputed lookup table** of prime fators for a insanely massive jump in processing speed for bits 1 to 1200 instead of brute forcing them with PrimeFactorizer.

** https://oeis.org/A001265/a001265.txt which in the java program is loaded as "mersenne_numbers_factors.txt"

@Vadimuh
Copy link
Author

Vadimuh commented Sep 28, 2023

I think the core idea is to use this precomputed lookup table** of prime fators for a insanely massive jump in processing speed for bits 1 to 1200 instead of brute forcing them with PrimeFactorizer.

** https://oeis.org/A001265/a001265.txt which in the java program is loaded as "mersenne_numbers_factors.txt"

Hi martin. It's been a while since I looked at this, so I'm mainly going to be drawing from an email exchange I had with hayguen prior to opening this issue.
I didn't think much of how my code did prime factorization compared to the current implementation, though it might be something worth optimizing.

Hayguen's implementation uses matrix exponentation to detect cycles of given lengths, and has a runtime complexity of O(N^3 * log(N)) (ignoring the aspect of how many factors of 2^n - 1 to check again).
In contrast, my implementation tests maximality of the polynomials using the method described in the first answer to this question here: https://cs.stackexchange.com/questions/62759/check-if-a-given-polynomial-is-primitive
and has a runtime complexity of O(N^2 * log(N)) (once again, ignoring the aspect of how many factors of 2^n - 1 to check again).

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

No branches or pull requests

3 participants