(define (solve)
(define (step n k)
(cond ((= n 3) k)
((even? n) (step (/ n 2) (+ 1 k)))
(else (step (* 3 (+ 1 n)) (+ 1 k)))))
(define (max-step m n)
(if (zero? n) m
(let ((s (step n 0)))
(max-step
(if (< (car m) s) (cons s n) m)
(- n 1)))))
(max-step (cons 0 0) 10000)
)
(display "(step . n) = ")
(display (solve))
(newline)
KGRlZmluZSAoc29sdmUpCiAgKGRlZmluZSAoc3RlcCBuIGspCiAgICAoY29uZCAoKD0gbiAzKSBrKQogICAgICAgICAgKChldmVuPyBuKSAoc3RlcCAoLyBuIDIpICgrIDEgaykpKQogICAgICAgICAgKGVsc2UgKHN0ZXAgKCogMyAoKyAxIG4pKSAoKyAxIGspKSkpKQogIChkZWZpbmUgKG1heC1zdGVwIG0gbikKICAgIChpZiAoemVybz8gbikgbQogICAgICAgIChsZXQgKChzIChzdGVwIG4gMCkpKQogICAgICAgICAgKG1heC1zdGVwCiAgICAgICAgICAgKGlmICg8IChjYXIgbSkgcykgKGNvbnMgcyBuKSBtKQogICAgICAgICAgICgtIG4gMSkpKSkpCiAgKG1heC1zdGVwIChjb25zIDAgMCkgMTAwMDApCiAgKQoKKGRpc3BsYXkgIihzdGVwIC4gbikgPSAiKQooZGlzcGxheSAoc29sdmUpKQoobmV3bGluZSkK