You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
343 B
18 lines
343 B
; Common Lisp version of a Prime Number Finder
|
|
; haplo@mindstab.net
|
|
|
|
(defun check (max i sq)
|
|
(if (> i sq)
|
|
(format t "~d~%" max)
|
|
(if (not (= (mod max i) 0))
|
|
(check max (+ i 2) sq))))
|
|
|
|
(defun _primes (max i)
|
|
(if (< i max)
|
|
(progn
|
|
(check i 3 (sqrt i))
|
|
(_primes max (+ i 2)))))
|
|
|
|
(defun primes (max)
|
|
(_primes max 3))
|
|
|
|
|