Primality by trial division: Difference between revisions

Content added Content deleted
m (Spelling/grammar/aesthetics)
No edit summary
Line 35: Line 35:
prime = 1
prime = 1
END FUNCTION
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}}==
=={{header|D}}==