This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A349954 #21 Mar 16 2022 02:54:46 %S A349954 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 A349954 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 A349954 17,12,19,4,21,4,5,6,15,10,1,18,19,22,3,2,5,14 %N A349954 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 A349954 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 A349954 a(10) = 4 because 2n+1 = 19 and iterating R on 19 gives 4 extrema: %e A349954 19 -> 29 -> 11 -> 17 -> 1 %e A349954 max min max min. %e A349954 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 A349954 n a(n) %e A349954 ----------------------------------------------------------------------------- ---- %e A349954 98 74 22 %e A349954 37 49 147 65 111 21 %e A349954 14 86 \__\__28_/ 42 100 20 %e A349954 95 21 55 73 83 97 129 63_____/ 225 19 %e A349954 54 36 \___\__\__\___\__16 24 48 32 72 18 %e A349954 \__\____________________\________81 61 243__/__/ 17 %e A349954 \______\___46 92 16 %e A349954 69 207 15 %e A349954 52 78 14 %e A349954 117__/ 13 %e A349954 62 88 12 %e A349954 93 297 11 %e A349954 70 94 84 56 10 %e A349954 105 79 141 189__/ 9 %e A349954 20 30__/ 106 142 8 %e A349954 \__45 159 53 213 7 %e A349954 68 34 60 40 90 160 80 6 %e A349954 29 153 77 85 13 51 17 67 89 135_/___/ 1215 405 5 %e A349954 \__22 50 58 44 66 26 64 96 \__10__/__/__/__/ 82 456 304 4 %e A349954 5 19 25 33 75 87 99_/ 39 729_/ 59 15 47 123 1539__/ 31 41 3 %e A349954 \__\__\___\__\__\__4 \___6____/___/ 76 38 2 8 18 \___12_____/__/ 2 %e A349954 \_________9 11 43 71 171 57 3 \__\_______27 91 35 23 7 1 %e A349954 \__\__\___\___\__\__\_______________1__/__/__/__/ 0 %o A349954 (Python) %o A349954 def R(k): c = 3*k+1; return c//(c&-c) %o A349954 def A349954(n): %o A349954 if n == 1: return 0 %o A349954 ct = 1; m = R(2*n-1); d = m - 2*n + 1 %o A349954 while m > 1: %o A349954 if (R(m) - m)*d < 0: ct += 1; d = -d %o A349954 m = R(m) %o A349954 return ct %Y A349954 Cf. A075677, A075680, A122458, A139391, A256598, A351974. %K A349954 nonn %O A349954 1,2 %A A349954 _Ya-Ping Lu_, Mar 11 2022