Skip to content

Instantly share code, notes, and snippets.

@kurohuku
Created November 1, 2010 00:27
Show Gist options
  • Save kurohuku/657370 to your computer and use it in GitHub Desktop.
Save kurohuku/657370 to your computer and use it in GitHub Desktop.
(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