(defun sieve (n) (let ((field (vec)) (primes (vec))) (range (i (0 (+ n 1))) (push field false)) (range (f (2 (+ n 1))) (unless (get field f) (push primes f) (let ((j f)) (while (<= j n) (set (get field j) true) (set j (+ j f)))))) primes)) (sieve 100000)