~dieggsy/project-euler

0eefb230650ae97dd9ac5934ff656329156fc386 — dieggsy 1 year, 9 months ago 9f0f91a
Ensure lisp miller rabin doesn't trip up on zero
1 files changed, 2 insertions(+), 1 deletions(-)

M sbcl/numbers.lisp
M sbcl/numbers.lisp => sbcl/numbers.lisp +2 -1
@@ 52,7 52,8 @@
(defun miller-rabin (n k)
  "Test N for primality by performing the Miller-Rabin test K times.
  Return NIL if N is composite, and T if N is probably prime."
  (cond ((= n 1)   nil)
  (cond ((zerop n) nil)
        ((= n 1)   nil)
        ((< n 4)     t)
        ((evenp n) nil)
        (t