a = input("from:") b = input("to:") k = input("max iterations:") p = 1 for i in range(a,b+1): print ("Steps for %d" % i) while p < k and i != 1 : p = p + 1 if i % 2 == 0: i = i / 2 else: i = (3*i) + 1 print i print ("The number of steps: %d" % (p-1)) print (".........") p = 1