n0=gets.to_i i=0 nmax=n0 while n0!=1 if n0%2==0 n0/=2 else n0=3*n0+1 end nmax=[nmax,n0].max i+=1 end p i p nmax