diff options
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) '()))) |