#Ruby, 48 bytes#
Ruby, 48 bytes
(f=->n{n>1&&1+f[n%2<1?n/2:3*n+1]||0})[gets.to_i]
Same as other Ruby, but using n%2?a:b syntax instead of [a,b][n%2]. Saves one char.
#Ruby, 48 bytes#
(f=->n{n>1&&1+f[n%2<1?n/2:3*n+1]||0})[gets.to_i]
Same as other Ruby, but using n%2?a:b syntax instead of [a,b][n%2]. Saves one char.
Ruby, 48 bytes
(f=->n{n>1&&1+f[n%2<1?n/2:3*n+1]||0})[gets.to_i]
Same as other Ruby, but using n%2?a:b syntax instead of [a,b][n%2]. Saves one char.