here is a revised one

Code:

15 M=2
20 M=nxtprm(M)
30 N=2^M-1
40 N2=sft(N,-1)
50 B=modpow(3,N2,N)
54 N3=sft(N-N2,-1)
55 B=modpow(B,N3,N)
75 if B=1 then print "2^";M;"-1 is prime":goto 20
80 goto 20

Can anyone try this in C++ to see if there's any speed difference at higher m values I really don't see any below 4000.

Joss