solution to problem 006 in lisp

master
Evan Hemsley 2016-10-22 12:41:52 -07:00
parent d2d74d9e48
commit 7c5ec0040c
1 changed files with 14 additions and 0 deletions

14
lisp/euler006.lisp Normal file
View File

@ -0,0 +1,14 @@
(load "euler.lisp")
(defun sum-of-squares-up-to (n)
(sum (mapcar (lambda (n) (* n n)) (range 1 n)))
)
(defun square-of-sum-up-to (n)
(let* ((square (sum (range 1 n))))
(* square square))
)
(defun solution ()
(- (square-of-sum-up-to 100) (sum-of-squares-up-to 100))
)