fork download
  1. t=int(input())
  2. for i in range(t):
  3. s=int(input())
  4. n=0
  5. if s==1:
  6. print(0)
  7. else:
  8. while s!=1:
  9. if s%2==0:
  10. s=s/2
  11. else:
  12. s=s*3+1
  13. n+=1
  14. print(n)
Success #stdin #stdout 0.03s 9916KB
stdin
5
1 
2
8
3
567
stdout
0
1
3
7
61