Lucas Lehmer prime Mersenne test
- To: mathgroup at smc.vnet.net
- Subject: [mg52261] Lucas Lehmer prime Mersenne test
- From: Roger Bagula <tftn at earthlink.net>
- Date: Thu, 18 Nov 2004 01:45:02 -0500 (EST)
- Reply-to: tftn at earthlink.net
- Sender: owner-wri-mathgroup at wolfram.com
The real problem with this test is that Mersenne number are grossly big, but the Lucas-Lehmer test recurrence is just bigger much too fast. I can't get it above n=8 in real time. The Lucas -Lehmer numbers are always ending in 4 and divisible by 2. Clear[s,a,b] (* Lucas Lehmer prime Mersenne test*) s[n_]:=s[n]=s[n-1]^2-2 s[1]=4 digits=8 a=Table[s[n],{n,1,8}] {4,14,194,37634,1416317954,2005956546822746114, 4023861667741036022825635656102100994, 16191462721115671781777559070120513664958590125499158514329308740975788034} a/2 {2,7,97,18817,708158977,1002978273411373057, 2011930833870518011412817828051050497, 8095731360557835890888779535060256832479295062749579257164654370487894017} (* Lucas -Lehmer test applied to Mersenne numbers*) b=Table[If[Mod[s[Prime[n]-1],2^Prime[n]-1]==0, 2^Prime[n]-1,0],{n,1,digits}] Respectfully, Roger L. Bagula tftn at earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : alternative email: rlbtftn at netscape.net URL : http://home.earthlink.net/~tftn