home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-04 | 481 b | 19 lines | [TEXT/ROSA] |
- ;
- ; File: primes.lisp
- ; Contents: Lisp program to generate all the prime numbers
- ; between 1 and n. It is quick and dirty, and uses
- ; a brute force approach to calculating them (i.e. it
- ; tries all possibilites).
- ;
- (defun primes (n1 n2)
- "Generate all the prime numbers between n1 and n2"
- (do ((i n1 (1+ i)))
- ((> i n2))
- (block inner
- (do ((j 2 (1+ j)))
- ((>= j i) (print i))
- (if (zerop (mod i j)) ; if found a divisor
- (return-from inner))))))
-
-
-