1 #include <iostream> 2 3 using namespace std; 4 5 int change(int n); 6 7 int main() 8 { 9 int n; 10 while(cin>>n && n>0) 11 cout<<change(n)<<endl; 12 13 return 0; 14 } 15 16 int change(int n) { 17 if(n%2==1 && n!=1) return change((3*n+1)/2)+1; 18 else if(n%2==0) return change(n/2)+1; 19 else if(n==1) return 0; 20 }