Jump to content

Primality by trial division: Difference between revisions

No edit summary
Line 37:
 
=={{header|Common Lisp}}==
(defun primep (a)
(ifcond ((= a 2) T)
((or (<= a 1) (= (mod a 2) 0)) nil)
(T)
(if (or (<=(loop nfor 1)i (=from 3 to (modsqrt a) by 2) 0))do
(nil)
(loop for i from 3 to (sqrt a) by 2
(if (= (mod a i) 0)
(return nil))) nil)
(T) T)))
 
=={{header|D}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.