Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #115 Feb 14 2024 10:46:55
%S 3,4,6,9,10,15,16,17,20,23,24,27,29,31,48,54,57,78,85,94,111,118,123,
%T 127,129,134,136,171,172,225,368,419,540,547,706,744,1112,1148,1169,
%U 1229,1308,1403,1545,1782,1869,1926,1939
%N Numbers k for which a generalized Collatz trajectory (x / k if k divides x, x + ceiling(x / k) otherwise) has non-elementary loops starting from a positive integer x_0 < k^2.
%C For a given k, define the generalized Collatz trajectory starting at x_0 > 0 as follows:
%C x_(i+1) = x_(i) / k if k divides x_(i);
%C x_(i+1) = x_(i) + ceiling(x_(i) / k) otherwise.
%C For k = 2, this is equivalent to the Collatz step x -> x/2 or (3x + 1)/2.
%C We call a loop an 'elementary loop' if it contains 1 as a term and otherwise a 'non-elementary loop'. The loop containing 1 consists of the terms 1, 4, 2, 1 for k = 2, or 1, 2, ..., k, 1 for other k.
%C k^2 has been chosen as an arbitrary boundary, giving more terms of the (limiting) sequence (i.e., the unknown sequence that would result if no boundary were used) than using 2*k, 3*k, or similar boundaries. It is unknown whether there are values of k for which non-elementary loops exist only for values greater than k^2.
%C It is also unknown whether there are values of k and x_0 for which trajectories do not contain any loop. Such values would be terms of the sequence only if there are also non-elementary loops.
%H Walter Carnielli, <a href="https://www.emis.de/journals/AMEN/2015/AMEN(150711).pdf">Some natural generalizations of the Collatz Problem</a>, Applied Mathematics E-Notes 15 (2015): 207-215.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Collatz_conjecture">Collatz Conjecture</a>.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Cycle_detection#Floyd's_tortoise_and_hare">Floyd's cycle detection algorithm</a>.
%H OEIS Wiki, <a href="https://oeis.org/wiki/3x%2B1_problem">3x+1 problem</a>.
%e k = 3 is a term since it has a non-elementary loop starting from x_0 = 7:
%e 7, 10, 14, 19, 26, 35, 47, 63, 21, 7, ...
%e k = 2 is not a term since it has no non-elementary loops starting from x_0 < 4.
%o (Python)
%o def containsloops(k):
%o for x_ in range(k, k*k):
%o s = 0
%o x = x_
%o m = x
%o while x != 1 and s <= m:
%o d, r = divmod(x, k)
%o x = d if r == 0 else d + x + 1
%o s += 1
%o m = max(m, x)
%o if s > m and x > k:
%o return True
%o return False
%o print([k for k in range(1, 100) if containsloops(k)])
%Y Cf. A006370.
%Y See A033478 for an example of a trajectory (based on the 3x + 1 formulation) with k = 2 and x_0 = 3, ending in an elementary loop.
%K nonn,more
%O 1,1
%A _Giuseppe Ciacco_, Dec 13 2023
%E a(43)-a(45) from _Giuseppe Ciacco_, Feb 05 2024
%E a(46)-a(48) from _Giuseppe Ciacco_, Feb 14 2024