## (Python 3) ## Print Collatz numbers with maximum ratio ## of highest descendent to self. #print("0 1") # Special case, all others congruent to 3 mod 4 #i = 3 #index = 1 #max_ratio = 1.0 #while(True): # n = i # max_n = n # while (n >= i): # Can stop as soon as sink below start # n = n + n + n + 1 # Bignum add is much faster than multiply. # max_n = max(n, max_n) # while ((n&1) == 0): # n = n >> 1 # ratio = float(max_n) / i # if (ratio > max_ratio): # max_ratio = ratio # print(index, i) # index += 1 # i += 4 0 1 1 3 2 7 3 15 4 27 5 703 6 1819 7 4255 8 4591 9 9663 10 26623 11 60975 12 77671 13 113383 14 159487 15 1212415 16 2684647 17 3041127 18 3873535 19 4637979 20 5656191 21 6416623 22 6631675 23 19638399 24 80049391 25 210964383 26 319804831 27 1410123943 28 70141259775 29 77566362559 30 110243094271 31 272025660543 32 446559217279 33 567839862631 # a(34) > 619100000003