Programming

(Racket) Collatz

steloflute 2024. 1. 9. 22:43
(define (collatz n) (displayln n) (if (<= n 1) 1 (if (even? n) (collatz (/ n 2)) (collatz (add1 (* 3 n))))))