Prime numbers



Hello,
I tried to write down Rabin-Miller primality test for Maxima. First I 
wrote it in the Maxima language. But since the algorithm demands 
computing powers modulo n, msetchk complains (WARNs, sorry :)) n is not 
prime, and moreover it calls primep on n first. (By the way, the fact 
that FOR statement is a BLOCK-like statement with respect to RETURN, is 
mentioned only in the DO article in the middle, hard to notice; why not 
mention it in the RETURN article as well?). Finally I decided to rewrite 
it in plain lisp to get rid of all those general calls when maxima has 
to typecheck arguments...

I would like to get feedback on the following points: function misuse in 
my code, missed maxima-kernel code idioms, missed lisp idioms. 
Comparision and benchmarking to the existing primep function are welcomed.

--
Andrei Zorine

Attached file: strongprime-older.lisp