View Single Post
Old 2006-10-19, 22:17   #1
jocelynl
 
Sep 2002

2×131 Posts
Default another mersenne prime test

Here is another Mersenne prime test.
I don't know about the speed I only tested it in UBasic upto n=4423 it works fine.


Code:
  15   M=2
   20   M=nxtprm(M)
   30   N=2^M-1
   40   B=3
   50   C=2
   60   B=modpow(B,N\C,N)
   70   C+=1
   74   if C<4 then 60
   75   if B=1 then print M;"is prime":goto 20
   80   goto 20
Joss
jocelynl is offline   Reply With Quote