Created
April 10, 2013 06:21
-
-
Save bitdewy/5352232 to your computer and use it in GitHub Desktop.
Project Euler #5 in Common Lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; | |
;;;; 5.lisp | |
;;;; ProjectEuler | |
;;;; | |
;;;; Created by bitdewy on 4/10/13. | |
;;;; Copyright (c) 2013 bitdewy. All rights reserved. | |
;;;; | |
;; Project Euler #5 | |
(defun smallest_multiple1 (max) | |
(do ((a 1 (1+ a)) (result 1 (lcm result a))) | |
((> a max) result) | |
t)) | |
(smallest_multiple1 20) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(defun smallest_multiple2 (max) | |
(reduce #'lcm | |
(do ((sequence nil) (i 1 (1+ i))) | |
((> i max) sequence) | |
(push i sequence)))) | |
(smallest_multiple2 20) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment