OFFSET
0,7
COMMENTS
If one considers an algebraic approach to the Collatz conjecture, the tree of outcomes of the "Half Or Triple Plus One" process starting with a natural number n:
i
0: n
1: 3n+1 n/2
2: 9n+4 (3/2)n+1/2 (3/2)n+1 n/4
3: 27n+13 (9/2)n+2 (9/2)n+5/2 (3/4)n+1/4 (9/2)n+4 (3/4)n+1/2 (3/4)n+1 n/8
...
reveals that any n that is part of a cycle satisfies an equation of the form (3^(i-p)/2^p - 1)n + x_i = 0, i = 0,1,2,3,..., p = 0..i, where the x_i are the possible constant terms at iteration i, i.e.,
x_0 = [0],
x_1 = [1,0],
x_2 = [4,1/2,1,0],
x_3 = [13,2,5/2,1/4,4,1/2,1,0],
x_4 = [40,13/2,7,1,17/2,5/4,7/4,1/8,13,2,5/2,1/4,4,1/2,1,0],
...
(Note that not all the combinations of members of x_i and numbers p yield an equation that corresponds to n having to belong to a cycle, instead satisfying at least one equation of the form above is a necessary condition for every n that does).
This sequence is composed of the number of new duplicates of possible constant terms at each iteration i. "New duplicates" refers to two identical constant terms appearing in the current iteration i, that have not appeared in any previous one j < i (because every duplicate in x_i yields two duplicates in x_(i+1), these are not counted).
This sequence is related to A275544, if one sequence is known it is possible to work out the other (see formula).
An empirical observation suggests that the same sequence of numbers arises if we analogously consider the 3n-1 problem (the Collatz conjecture can be referred to as the 3n+1 problem).
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..44
Wikipedia, Collatz conjecture
EXAMPLE
a(3) = 0 since all the members of x_3 are distinct.
a(4) = 1 since in x_4 the number 1 appears twice (there is 1 duplicate).
MATHEMATICA
nmax = 25; s = {0}; b[0] = 1;
Do[s = Join[3 s + 1, s/2]; Print[n]; b[n] = s // Union // Length, {n, 1, nmax}];
a[n_] := If[n == 0, 0, 2 b[n - 1] - b[n]];
a /@ Range[0, nmax] (* Jean-François Alcover, Nov 16 2019 *)
PROG
(PARI) first(n)=my(v=vector(n), u=[0], t); for(i=1, n, t=2*#u; u=Set(concat(vector(#u, j, 3*u[j]+1), u/2)); v[i]=t-#u); concat(0, v) \\ Charles R Greathouse IV, Aug 05 2016
(Python)
from gmpy2 import mpq
from itertools import count, islice
def agen(): # generator of terms
reach = {0}
yield 0
for n in count(1):
shell = [3*q+1 for q in reach]
shell += [q*mpq(1, 2) for q in reach]
shell_set = set(shell)
yield len(shell) - len(shell_set)
reach |= shell_set
print(list(islice(agen(), 20))) # Michael S. Branicky, Nov 06 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Rok Cestnik, Aug 01 2016
EXTENSIONS
a(27)-a(29) corrected and a(30) onward using b-file at A275544 by Michael S. Branicky, Nov 06 2025
STATUS
approved
