Post History
Ruby, 33 bytes Recursive lambda solution. c=->n{n<2?0:1+c[n%2<1?n/2:n*3+1]} c=->n{ } # c = lambda taking `n` n<2? : # if n...
Answer
#1: Initial revision
# [Ruby], 33 bytes Recursive lambda solution. ```ruby c=->n{n<2?0:1+c[n%2<1?n/2:n*3+1]} c=->n{ } # c = lambda taking `n` n<2? : # if n < 2... 0 # return 0... 1+c[ ] # else return 1 + collatz count for... n%2<1? : # if n is even... n/2 # n / 2... n*3+1 # else 3n + 1 ``` [Try it online!][TIO-kto1bee5] [Ruby]: https://www.ruby-lang.org/ [TIO-kto1bee5]: https://tio.run/##KypNqvz/P9lW1y6vOs/GyN7AylA7OTpP1cjG0D5P38gqT8tY2zC29n9BaUmxgoahnp6hgaZebmJBdU1mTXJ0JlAGAA "Ruby – Try It Online"