mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-06 10:31:34 -08:00
9 lines
216 B
Common Lisp
9 lines
216 B
Common Lisp
;;; primes
|
|
|
|
(defun primep (x)
|
|
(or (= 2 x)
|
|
(and (integerp x)
|
|
(> x 2)
|
|
(not (zerop (mod x 2)))
|
|
(loop :for i :from 3 :to (isqrt x) :by 2
|
|
:never (zerop (mod x i))))))
|