%I #76 May 07 2021 00:49:19
%S 2,5,1,4,5,1,4,2,1,2,3,1,5,5,1,6,2,1,2,5,1,3,3,1,3,2,1,2,4,1,6,10,1,5,
%T 2,1,2,3,1,5,8,1,4,2,1,2,4,1,3,3,1,3,2,1,2,18,1,5,4,1,6,2,1,2,3,1,4,4,
%U 1,5,2,1,2,7,1,3,3,1,3,2,1,2,7,1,4,9,1,4,2,1
%N a(n) gives the number of side-branches that will be passed, if A342369 is used to trace the Collatz tree backward starting at 6*n-2 with n > 0.
%C Recursion into A342369 means tracing the Collatz tree backward, starting at k = A342369(6*n-2), then k = A342369(k) until k is divisible by 3. At each A342369(k) = 3*m - 1, a new side-branch is connected which would start at 6*m-2. If A342369(k) reached a value divisible by three no further side-branches will be found.
%C This sequence is a rearrangement of A087088 such that all values at positions divisible by 3 are unchanged.
%H Thomas Scheuerle, <a href="/A340407/b340407.txt">Table of n, a(n) for n = 1..5000</a>
%H <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%F a(n) > 0.
%F a(3*n) = 1.
%F a(9*n - b) = 2, b = {1, 8} row 2 of A342261. ( a(A056020(n)) = 2 ).
%F a(27*n - b) = 3, b = {2, 4, 5, 16} row 3 of A342261.
%F a(81*n - b) = 4, b = {13, 14, 22, 34, 38, 52, 74, 77} row 4 of A342261.
%F a(3^k*n - b) = k, b = row k of A342261.
%F ( Sum_{k=1..j} a(k) )/j lim_{j->infinity} = 3 = Sum_{k=1..infinity} k*2^(k-1)/3^k.
%e n = 2:
%e 6*n-2 = 10.
%e A342369(10) = 20. -> 7*3 - 1 -> A side-branch is connected.
%e A342369(20) = 13.
%e A342369(13) = 26. -> 9*3 - 1 -> A side-branch is connected.
%e A342369(26) = 17. -> 6*3 - 1 -> A side-branch is connected.
%e A342369(17) = 11. -> 4*3 - 1 -> A side-branch is connected.
%e A342369(11) = 7.
%e A342369(7) = 14. -> 5*3 - 1 -> A side-branch is connected.
%e A342369(14) = 9. -> divisible by 3 we stop here.
%e -> We found 5 connected side-branches, a(2) = 5.
%o (MATLAB)
%o function a = A340407( max_n )
%o for n = 1:max_n
%o c = 0;
%o s = 6*n -2;
%o while mod(s,3) ~= 0
%o s = A342369( s );
%o if mod(s,3) == 2
%o c = c+1;
%o end
%o end
%o a(n) = c;
%o end
%o end
%o function b = A342369( n )
%o if mod(n,3) == 2
%o b = (2*n - 1)/3;
%o else
%o b = 2*n;
%o end
%o end
%Y Cf. A014682, A342369, A342261, A087088.
%K nonn
%O 1,1
%A _Thomas Scheuerle_, Mar 24 2021