%I #21 Mar 16 2022 02:54:46
%S 0,2,1,2,3,2,1,2,1,4,1,2,5,20,3,18,5,2,3,8,19,4,1,18,3,4,1,20,5,8,3,
%T 18,3,6,1,18,21,2,3,6,3,20,1,4,7,16,3,18,21,4,5,14,7,18,19,10,1,4,3,6,
%U 17,12,19,4,21,4,5,6,15,10,1,18,19,22,3,2,5,14
%N a(n) is the number of extrema that result from iterating the reduced Collatz function R(k) = A139391(k) on 2n-1 to yield 1.
%C The trajectory starts with a minimum for odd n and with a maximum (see A351974) for even n (>=2). Since the trajectory always stops at 1 (a minimum) assuming the Collatz conjecture holds, a(n) is odd if n is odd and vice versa.
%e a(10) = 4 because 2n+1 = 19 and iterating R on 19 gives 4 extrema:
%e 19 -> 29 -> 11 -> 17 -> 1
%e max min max min.
%e The corresponding path of n, 10 -> 15 -> 6 -> 9 -> 1, is shown in the tree below, where the paths for n up to 100 are given and a(n) is the depth from n to 1.
%e n a(n)
%e ----------------------------------------------------------------------------- ----
%e 98 74 22
%e 37 49 147 65 111 21
%e 14 86 \__\__28_/ 42 100 20
%e 95 21 55 73 83 97 129 63_____/ 225 19
%e 54 36 \___\__\__\___\__16 24 48 32 72 18
%e \__\____________________\________81 61 243__/__/ 17
%e \______\___46 92 16
%e 69 207 15
%e 52 78 14
%e 117__/ 13
%e 62 88 12
%e 93 297 11
%e 70 94 84 56 10
%e 105 79 141 189__/ 9
%e 20 30__/ 106 142 8
%e \__45 159 53 213 7
%e 68 34 60 40 90 160 80 6
%e 29 153 77 85 13 51 17 67 89 135_/___/ 1215 405 5
%e \__22 50 58 44 66 26 64 96 \__10__/__/__/__/ 82 456 304 4
%e 5 19 25 33 75 87 99_/ 39 729_/ 59 15 47 123 1539__/ 31 41 3
%e \__\__\___\__\__\__4 \___6____/___/ 76 38 2 8 18 \___12_____/__/ 2
%e \_________9 11 43 71 171 57 3 \__\_______27 91 35 23 7 1
%e \__\__\___\___\__\__\_______________1__/__/__/__/ 0
%o (Python)
%o def R(k): c = 3*k+1; return c//(c&-c)
%o def A349954(n):
%o if n == 1: return 0
%o ct = 1; m = R(2*n-1); d = m - 2*n + 1
%o while m > 1:
%o if (R(m) - m)*d < 0: ct += 1; d = -d
%o m = R(m)
%o return ct
%Y Cf. A075677, A075680, A122458, A139391, A256598, A351974.
%K nonn
%O 1,2
%A _Ya-Ping Lu_, Mar 11 2022
|