Lua, 75 bytes
function C(x)z=0 while x>1 do x=({x//2,3*x+1})[x%2+1]z=z+1 end return z end
J. А. del Rio - слава СССР
- 359
- 3
- 6
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchangefunction C(x)z=0 while x>1 do x=({x//2,3*x+1})[x%2+1]z=z+1 end return z end