solution to problem 007 in lisp

master
Evan Hemsley 2016-10-22 13:04:08 -07:00
parent 7c5ec0040c
commit f6a2d0acb3
2 changed files with 6 additions and 1 deletions

View File

@ -10,7 +10,7 @@
)
(defun prime (n)
(eq (length (member T (mapcar (lambda (a) (eq (mod n a) 0)) (range 2 (sqrt n))))) 0)
(eq (length (member T (mapcar (lambda (a) (and (eq (mod n a) 0) (/= n a))) (range 2 (sqrt n))))) 0)
)
(defun cartesian-helper (thing list)

5
lisp/euler007.lisp Normal file
View File

@ -0,0 +1,5 @@
(load "euler.lisp")
(defun solution ()
(first (reverse (loop for i from 2 when (prime i) collect i into prime-list when (eq 10001 (length prime-list)) return prime-list)))
)