#include <stdio.h>
#include <stdlib.h>
unsigned long long f(unsigned long long x){
if (x%2==0)
return x/2;
else
return 3*x+1;
}
int main(){
unsigned int i, j, sum, *ii, cnt, k, l, m;
unsigned long long temp, *jj;
while (scanf("%lu%lu",&i
,&j
)!=EOF
) {
m=1;
cnt=i;
sum=0;
ii
=(unsigned int*)calloc(j
-i
+1, sizeof(unsigned int)); for (temp=(unsigned long long)cnt;cnt<=j;cnt++)
{
temp=(unsigned long long)cnt;
if (ii[cnt-i]!=0)
continue;
for (k
=1,temp
=(unsigned long long)cnt
,jj
=(unsigned long long *)calloc(1000,sizeof(unsigned long long));1;k
++) {
jj
=(unsigned long long *)calloc(1000,sizeof(unsigned long long)); if (cnt==1)
{
ii[0]=1;
break;
}
jj[k-1]=temp;
temp=f(temp);
if (temp > (unsigned long long)j || temp<(unsigned long long) i)
continue;
if (ii[temp-i]!=0 || temp == 1)
{
for (l=k;l>=1;l--)
{
if (jj[l-1]>(unsigned long long)j || jj[l-1]<(unsigned long long)i)
continue;
else
ii[jj[l-1]-1]=ii[temp-i]+k-l+1;
}
if (m<ii[jj[k-1]-1])
{
m=ii[jj[k-1]-1];
printf("%lu,%lu,%lu\n",jj
[k
-1],k
,k
);
}
break;
}
}
}
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCnVuc2lnbmVkIGxvbmcgbG9uZyBmKHVuc2lnbmVkIGxvbmcgbG9uZyB4KXsKICAgIGlmICh4JTI9PTApCiAgICAgICByZXR1cm4geC8yOwogICAgZWxzZQogICAgICAgIHJldHVybiAzKngrMTsKfQoKaW50IG1haW4oKXsKICAgIHVuc2lnbmVkIGludCBpLCBqLCBzdW0sICppaSwgY250LCBrLCBsLCBtOwogICAgdW5zaWduZWQgbG9uZyBsb25nIHRlbXAsICpqajsKICAgIHdoaWxlIChzY2FuZigiJWx1JWx1IiwmaSwmaikhPUVPRikKICAgIHsKICAgICAgICAgIG09MTsKICAgICAgICAgIGNudD1pOwogICAgICAgICAgc3VtPTA7CiAgICAgICAgICBpaT0odW5zaWduZWQgaW50KiljYWxsb2Moai1pKzEsIHNpemVvZih1bnNpZ25lZCBpbnQpKTsKICAgICAgICAgIGZvciAodGVtcD0odW5zaWduZWQgbG9uZyBsb25nKWNudDtjbnQ8PWo7Y250KyspCiAgICAgICAgICB7CiAgICAgICAgICAgICAgdGVtcD0odW5zaWduZWQgbG9uZyBsb25nKWNudDsKICAgICAgICAgICAgICBpZiAoaWlbY250LWldIT0wKQogICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgIGZvciAoaz0xLHRlbXA9KHVuc2lnbmVkIGxvbmcgbG9uZyljbnQsamo9KHVuc2lnbmVkIGxvbmcgbG9uZyAqKWNhbGxvYygxMDAwLHNpemVvZih1bnNpZ25lZCBsb25nIGxvbmcpKTsxO2srKykKICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgIGZyZWUoamopOwogICAgICAgICAgICAgICAgICBqaj0odW5zaWduZWQgbG9uZyBsb25nICopY2FsbG9jKDEwMDAsc2l6ZW9mKHVuc2lnbmVkIGxvbmcgbG9uZykpOwogICAgICAgICAgICAgICAgICBpZiAoY250PT0xKQogICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgIGlpWzBdPTE7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGpqW2stMV09dGVtcDsKICAgICAgICAgICAgICAgICAgdGVtcD1mKHRlbXApOwogICAgICAgICAgICAgICAgICBpZiAodGVtcCA+ICh1bnNpZ25lZCBsb25nIGxvbmcpaiB8fCB0ZW1wPCh1bnNpZ25lZCBsb25nIGxvbmcpIGkpCiAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICBpZiAoaWlbdGVtcC1pXSE9MCB8fCB0ZW1wID09IDEpCiAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgZm9yIChsPWs7bD49MTtsLS0pCiAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChqaltsLTFdPih1bnNpZ25lZCBsb25nIGxvbmcpaiB8fCBqaltsLTFdPCh1bnNpZ25lZCBsb25nIGxvbmcpaSkKICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgaWlbampbbC0xXS0xXT1paVt0ZW1wLWldK2stbCsxOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGlmIChtPGlpW2pqW2stMV0tMV0pCiAgICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgbT1paVtqaltrLTFdLTFdOwogICAgICAgICAgICAgICAgICAgICAgICBwcmludGYoIiVsdVxuIixrKTsKICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIlbHUsJWx1LCVsdVxuIixqaltrLTFdLGssayk7CiAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgICAgZnJlZShpaSk7CiAgICB9CiAgICByZXR1cm4gMDsKfQ==