#include<stdio.h>
int main()
{
long int i = 0,n, m, count = 0, t;
while(scanf("%ld %ld", &n, &m) && n>0 && m>0)
{
t = n, count = 0;
while(n<=m)
{
count++;
if(n == 1)
break;
if(n%2 != 0)
n = n*3 +1;
else
n = n/2;
}
i++;
printf("Case %ld: A = %ld, limit = %ld, number of terms = %ld\n", i, t, m, count);
}
return 0;
}
int main()
{
long int i = 0,n, m, count = 0, t;
while(scanf("%ld %ld", &n, &m) && n>0 && m>0)
{
t = n, count = 0;
while(n<=m)
{
count++;
if(n == 1)
break;
if(n%2 != 0)
n = n*3 +1;
else
n = n/2;
}
i++;
printf("Case %ld: A = %ld, limit = %ld, number of terms = %ld\n", i, t, m, count);
}
return 0;
}
Comments
Post a Comment