Skip to content

Instantly share code, notes, and snippets.

@delihiros
Created October 11, 2012 17:14
Show Gist options
  • Save delihiros/3874010 to your computer and use it in GitHub Desktop.
Save delihiros/3874010 to your computer and use it in GitHub Desktop.
(defun solver (x)
(- (+ (sum-to 5 (- x 1) 0) (sum-to 3 (- x 1) 0)) (sum-to 15 (- x 1) 0)))
(defun sum-to (n x s)
(cond ((eq x 0) s)
((eq 0 (mod x n)) (sum-to n (- x 1) (+ s x)))
(t (sum-to n (- x 1) s))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment