A375494 a(n) = minimum number of operations chosen from f(x) = 3x+1 and g(x) = floor(x/2) needed to reach n when starting from 1.
1, 0, 2, 4, 1, 6, 3, 3, 8, 5, 5, 5, 10, 2, 7, 7, 7, 7, 12, 4, 4, 9, 4, 9, 9, 9, 9, 14, 6, 6, 6, 6, 11, 6, 6, 11, 11, 11, 11, 11, 3, 16, 8, 8, 8, 8, 8, 8, 13, 8, 8, 8, 8, 13, 13, 13, 13, 13, 5, 13, 5, 5, 18, 10, 10, 10, 10, 5, 10, 10, 10, 10, 15, 10, 10, 10, 10, 10, 10, 10
Offset: 0
Keywords
Examples
For example, to start with 1 and produce the number 7. The shortest sequence is unique and length 3: (3*x+1, floor(x/2), 3*x+1) = f(g(f(x_0))), which follows the trajectory x_0=1, x_1=4, x_2=2, x_3=7.
Links
- Eric Weisstein's World of Mathematics, Collatz Problem
Programs
-
Python
from itertools import product seq = [None for _ in range(200)] num = [ 0 for _ in range(len(seq))] for L in range(0, 23): for P in product((True, False), repeat=L): x = 1 for upward in P: x = 3*x+1 if upward else x//2 if x < len(seq): if num[x] == 0 or L < seq[x]: seq[x], num[x] = L, 1 elif L == seq[x]: num[x] += 1 print(', '.join([str(x) for x in seq]))
Comments