#include<iostream>
#include<iomanip>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
long long int a,b,c=1,d,e;
while(cin>>a>>b){
if(a<0&&b<0){
break;
}
e=a;
d=1;
while(a!=1){
if(a%2==0){
a=a/2;
}else{
a=(3*a)+1;
}
if(a>b){
break;
}
d++;
}
cout<<"Case "<<c<<": A = "<<e<<", limit = "<<b<<", number of terms = "<<d<<endl;
c++;
}
system("pause");
return 0;
}
沒有留言:
張貼留言