Skip to content

Instantly share code, notes, and snippets.

@bitdewy
Last active December 15, 2015 21:39
Show Gist options
  • Save bitdewy/5327062 to your computer and use it in GitHub Desktop.
Save bitdewy/5327062 to your computer and use it in GitHub Desktop.
Project Euler #1 in Common Lisp
;;;;
;;;; 1.lisp
;;;; ProjectEuler
;;;;
;;;; Created by bitdewy on 4/7/13.
;;;; Copyright (c) 2013 bitdewy. All rights reserved.
;;;;
;; Project Euler #1
(defun sum_of_values_multiples (max values)
"evaluate sum of values multiples less than max"
(do ((sum 0) (i 1 (1+ i)))
((eq i max) sum)
(dolist (v values)
(if (and (zerop (mod i v)) (incf sum i))
(return)))))
(sum_of_values_multiples 1000 '(3 5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment