solution to problem 005 in lisp

master
Evan Hemsley 2016-10-22 12:36:28 -07:00
parent b3d28777fd
commit d2d74d9e48
1 changed files with 9 additions and 0 deletions

9
lisp/euler005.lisp Normal file
View File

@ -0,0 +1,9 @@
(load "euler.lisp")
(defun is-evenly-divisible-by-all-up-to (n int)
(eq 0 (sum (mapcar (partial #'mod n) (range 2 int))))
)
(defun solution ()
(loop for i from 2 by 2 when (is-evenly-divisible-by-all-up-to i 20) do (return i))
)