Last active
December 14, 2019 12:41
-
-
Save corehello/4d0171f1147c25ea0f4037843927b6d6 to your computer and use it in GitHub Desktop.
collatz-conjecture in common lisp
This file contains hidden or 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
(defun collatz-conjecture (n) | |
(progn | |
(print n) | |
(cond | |
((= n 1) n) | |
((= (mod n 2) 0) (collatz-conjecture (/ n 2))) | |
((= (mod n 2) 1) (collatz-conjecture (+ 1 (* n 3))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment