[sage-edu] Lucas-Lehmer Test

2009-01-23 Thread A. Jorge Garcia
I'm still trying to learn a bit about Sage in general and python in particular. I was trying to code the Lucas-Lehmer Test for primality of Mersenne Numbers of the form 2**p-1 where p is an odd integer. I found this code on wikipedia def lucas_lehmer(p): s = 4 m = (2**p)-1 for i in

[sage-edu] Re: Lucas-Lehmer Test

2009-01-23 Thread William Stein
On Fri, Jan 23, 2009 at 6:06 PM, A. Jorge Garcia wrote: > > I'm still trying to learn a bit about Sage in general and python in > particular. I was trying to code the Lucas-Lehmer Test for primality > of Mersenne Numbers of the form 2**p-1 where p is an odd integer. > > I found this code on wiki

[sage-edu] Re: Lucas-Lehmer Test

2009-01-23 Thread CalcPage
In a message dated 1/23/2009 9:12:19 P.M. Eastern Standard Time, wst...@gmail.com writes: That is not the point of lucas-lehmer. The point is to determine whether or not 2^p - 1 is a prime number more quickly than ... say checking for divisibility by primes up to sqrt(2^p - 1). OK, I s