# The 3n+1 problem-
#Consider the following algorithm to generate a sequence of numbers. Start with an integer n. If n is even, divide by 2.
#If n is odd:
#        multiply by 3 and add 1.
# Repeat this process with the new value of n, terminating when n = 1. For example, the following sequence of numbers will be generated for n = 22:
#22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
# It is conjectured (but not yet proven) that this algorithm will terminate at n = 1 for every integer n.

#Input-The input will consist of a series of pairs of integers i and j, one pair of integers per line. All integers will be less than 1,000,000 and greater than 0.

# Output-For each pair of input integers i and j, output i, j in the same order in which they appeared in the input and then the maximum cycle length for integers between and including i and j.

import sys

def 3n1(n):
        cycle=0
        while n!=1:
                if n%2!=0:
                        n=3*n+1         
                else:
                        n=n/2
                cycle+=1
        return cycle

if __name__=='__main__':
        args=sys.argv[:]
        start, end= args[:2]
        start=int(start)
        end=int(end)
        maxcount=0
        for i in range(start, end+1):
                count= 3n1(i)
                if count>maxcount:
                        maxcount=count
                i+=1
                
                        
