OFFSET
0,1
COMMENTS
Or least k such that the bottom entry in the absolute difference triangle of the elements in the Collatz trajectory of k is equal to n, or 0 if no such k exists.
EXAMPLE
a(3) = 168 because the Collatz trajectory of 168 is T = 168 -> 84 -> 42 -> 21 -> 64 -> 32 -> 16 -> 8 -> 4 -> 2 -> 1 and the absolute difference triangle of the elements of T is:
168 84 42 21 64 32 16 8 4 2 1
84, 42, 21, 43, 32, 16, 8, 4, 2, 1
42, 21, 22, 11, 16, 8, 4, 2, 1
21, 1, 11, 5, 8, 4, 2, 1
20, 10, 6, 3, 4, 2, 1
10, 4, 3, 1, 2, 1
6, 1, 2, 1, 1
5, 1, 1, 0
4, 0, 1
4, 1
3
with bottom entry = A359247(168) = 3.
MATHEMATICA
nn=20000; Collatz[n_]:=NestWhileList[If[EvenQ[#], #/2, 3#+1]&, n, #>1&]; Flatten[Table[Collatz[n], {n, nn}]]; Do[k=1; Table[d=Collatz[m]; While[Length[d]>1, d=Abs[Differences[d]]]; If[d[[1]]==u&&k==1, Print[u, " ", m]; k=0], {m, nn}], {u, 0, 22}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Jan 10 2023
STATUS
approved