diff options
author | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2017-02-21 21:09:39 +0700 |
---|---|---|
committer | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2017-02-21 21:09:39 +0700 |
commit | 7d19f480637e9e880b98dabfbcf8e885b0a2d3b9 (patch) | |
tree | fa52914a2e58bc13570839fa297be05b7b7616bf /others/volume1/086.scm | |
parent | f2d4bc6b7c302dee2d84a3acf84b83b5a98c45fa (diff) | |
download | cp-7d19f480637e9e880b98dabfbcf8e885b0a2d3b9.tar.gz |
Update others/volume1
Diffstat (limited to 'others/volume1/086.scm')
-rw-r--r-- | others/volume1/086.scm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/others/volume1/086.scm b/others/volume1/086.scm new file mode 100644 index 0000000..a45a81d --- /dev/null +++ b/others/volume1/086.scm @@ -0,0 +1,7 @@ +(define (collatz n output) + (if (> n 1) + (if (= (remainder n 2) 0) + (collatz (quotient n 2) (append output '("x 2\n"))) + (collatz (+ (* n 3) 1) (append output '("div 3\n")))) + output)) +(for-each display (reverse (collatz (read) '()))) |