Hello! I am trying to write an alternative test method for the primality of Mersenne numbers based on the paper "An Elliptic Curve test for Mersenne primes" by B.H. Gross.
I tried to implement the resulting algorithm in Sage, it did work, BUT there is still one problem: the Algorithm should not need the full amount of iterations if the tested Mersenne number Mp is not prime. The Algorithm works as follows: Initialize the value for p G←−2 for i from 1 to p − 1 do G ← (G^2 + 12)^2/(4 · G · (G^2 − 12)) (mod Mp) If G does not exist, then stop the Algorithm, Mp is not prime end do If G = 0 then Mp is prime else Mp is not prime How can I interrupt the loop? I tried a try...except statement, but it seems that the ringarithmetic of Sage doesn't produce an error if an element to be divided by is not invertible. I will also post my code for the routine (there I have to admit that I'm totally new to Sage and so I'm quite sure the way I tried to implement that is not very elegant or efficient). Thanks a lot for your support! P.S.: I don't know exactly how the is_prime() statement works, maybe that test could make it a little faster since it needs less operations than the Lucas-Lehmer-Test. -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
