Created
April 7, 2013 16:55
-
-
Save bitdewy/5331290 to your computer and use it in GitHub Desktop.
Project Euler #2 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
;;;; | |
;;;; 2.lisp | |
;;;; ProjectEuler | |
;;;; | |
;;;; Created by bitdewy on 4/8/13. | |
;;;; Copyright (c) 2013 bitdewy. All rights reserved. | |
;;;; | |
;; Project Euler #2 | |
(defun fibonacci (max) | |
"generate fibonacci sequence do not exceed max" | |
(do ((sequence nil) (cur 1 next) (next 2 (+ cur next))) | |
((> cur max) (reverse sequence)) | |
(push cur sequence))) | |
(reduce #'+ | |
(remove-if-not #'evenp (fibonacci 4000000))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment