Created
November 1, 2010 00:27
-
-
Save kurohuku/657370 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun eratosthenes (n) | |
(loop | |
:for lst = (loop :for i from 2 to n :collect i) then lst | |
:for x = (car lst) | |
:while lst | |
:collect x | |
:do | |
(setf lst | |
(delete-if | |
#'(lambda (n) (zerop (mod n x))) | |
lst)))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment