2016-01-31 00:02:06
#include <bits/stdc++.h>
using namespace std;
int main()
{long long a,l,i,temp,p;
while(scanf("%lld%lld",&a,&l)==2)
{temp=1;
 p=a;
if((a<0&&l<0))
{
return 0;
}
for(i=1;i!=0;i++)
{
if(a==1)
{
break;
}
if(a%2==0)
{
a=a/2;
}
else
{
a=a*3+1;
}
if(a>l)
{
break;
}
 
}
cout<<"Case "<<temp++<<": A = "<<p<<", limit = "<<l<<", number of terms = "<<i<<endl;
}
return 0;
}
 
Invalid Email or Password