Jump to content

Primality by trial division: Difference between revisions

no edit summary
m (Spelling/grammar/aesthetics)
No edit summary
Line 35:
prime = 1
END FUNCTION
 
=={{header|Common Lisp}}==
(defun primep (a)
(if (= a 2)
(T)
(if (or (<= n 1) (= (mod a 2) 0))
(nil)
(loop for i from 3 to (sqrt a) by 2
(if (= (mod a i) 0)
(nil)))
(T))))
 
=={{header|D}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.