From ab11ad9a8b6cf46131620a49486e91656b9d913b Mon Sep 17 00:00:00 2001 From: Mistivia Date: Mon, 16 Sep 2024 14:22:20 +0800 Subject: 1 Multiples of 3 or 5 --- 0001/main.lisp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 0001/main.lisp diff --git a/0001/main.lisp b/0001/main.lisp new file mode 100644 index 0000000..c7ba165 --- /dev/null +++ b/0001/main.lisp @@ -0,0 +1,13 @@ +(defun genlist (n) + (defun impl (x lst) + (if (> x n) + (reverse lst) + (impl (+ 1 x) (cons x lst)))) + (impl 1 '())) + +(let ((sum 0)) + (loop for x in (genlist 999) + do (if (or (equal 0 (mod x 3)) + (equal 0 (mod x 5))) + (setf sum (+ sum x)))) + (print sum)) -- cgit v1.0