The last line of $strongprime should be nil) and not '$FALSE)). This way
is correctly identifies Mersenne numbers at least, and does fast. More
benchmarks are needed (but I believe now it's stable enough).
--
A.Z.
> (DEFMFUN $STRONGPRIME(N B)
> (LET ((S (SUB1 N)) (NM1 (SUB1 N)) (R 0) X)
> (DO () ((MODDP S) S)
> (SETQ R (+ 1 R) S (DIV S 2)))
> (LET ((MODULUS N))
> (SETQ X (CEXPT B S)))
> (IF (OR (= X 1) (= X -1))
> (RETURN-FROM $STRONGPRIME T))
> (SETQ R (SUB1 R))
> (DO ((J 0 (+ 1 J)))
> ((> J R) NIL)
> (SETQ X (MOD (* X X) N))
> (COND
> ((LIKE X NM1) (RETURN-FROM $STRONGPRIME T))
> ((LIKE X 1) (RETURN-FROM $STRONGPRIME NIL))))
> '$FALSE))
^^^^^^^^^
Should be: NIL))