#include<stdio.h>
int main()
{
long long int i,j,k,l,m,n,p,a,t;
while(scanf("%lld%lld",&i,&j)==2)
{
if((i==0)&&(j==0))
break;
m=0;
p=i;
t=j;
if(i>j)
{
k=p;
p=t;
t=k;
}
for(n=p;n<=t;n++)
{
l=n;
a=1;
while(l!=1)
{
if((l%2)==0)
{
l=l/2;
a++;
}
else
{
l=3*l+1;
a++;
}
}
if(a>m)
m=a;
}
printf("%lld %lld %lld\n",i,j,m);
}
return 0;
}
int main()
{
long long int i,j,k,l,m,n,p,a,t;
while(scanf("%lld%lld",&i,&j)==2)
{
if((i==0)&&(j==0))
break;
m=0;
p=i;
t=j;
if(i>j)
{
k=p;
p=t;
t=k;
}
for(n=p;n<=t;n++)
{
l=n;
a=1;
while(l!=1)
{
if((l%2)==0)
{
l=l/2;
a++;
}
else
{
l=3*l+1;
a++;
}
}
if(a>m)
m=a;
}
printf("%lld %lld %lld\n",i,j,m);
}
return 0;
}
No comments:
Post a Comment