cp's OEIS Frontend

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.

Showing 1-2 of 2 results.

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.

Original entry on oeis.org

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, 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, 17, 12, 19, 4, 21, 4, 5, 6, 15, 10, 1, 18, 19, 22, 3, 2, 5, 14
Offset: 1

Views

Author

Ya-Ping Lu, Mar 11 2022

Keywords

Comments

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.

Examples

			a(10) = 4 because 2n+1 = 19 and iterating R on 19 gives 4 extrema:
19 -> 29 -> 11 -> 17 -> 1
      max   min   max   min.
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.
                                       n                                      a(n)
----------------------------------------------------------------------------- ----
                                                    98     74                  22
                                             37 49 147 65 111                  21
                        14                86  \__\__28_/   42  100             20
                     95 21  55 73 83  97 129        63_____/   225             19
                  54 36  \___\__\__\___\__16        24          48  32 72      18
                   \__\____________________\________81     61  243__/__/       17
                                                     \______\___46  92         16
                                                                69 207         15
                                                                52  78         14
                                                               117__/          13
                                      62                        88             12
                                      93                       297             11
                                      70            94          84  56         10
                                     105  79       141         189__/           9
                                  20  30__/        106         142              8
                                   \__45           159 53      213              7
         68                           34            60 40  90  160  80          6
     29 153    77           85    13  51  17 67 89 135_/___/  1215 405          5
      \__22 50 58 44 66 26  64 96  \__10__/__/__/__/       82  456 304          4
5 19 25  33 75 87 99_/  39 729_/  59  15               47 123 1539__/  31 41    3
\__\__\___\__\__\__4     \___6____/___/   76 38  2   8 18   \___12_____/__/     2
                   \_________9 11 43  71 171 57  3   \__\_______27  91 35 23 7  1
                             \__\__\___\___\__\__\_______________1__/__/__/__/  0
		

Crossrefs

Programs

  • Python
    def R(k): c = 3*k+1; return c//(c&-c)
    def A349954(n):
        if n == 1: return 0
        ct = 1; m = R(2*n-1); d = m - 2*n + 1
        while m > 1:
            if (R(m) - m)*d < 0: ct += 1; d = -d
            m = R(m)
        return ct

A377009 Number of odd terms in the Collatz trajectory of k = 4n-1 which are a new record high among its odd terms.

Original entry on oeis.org

1, 2, 1, 3, 1, 2, 14, 13, 1, 3, 1, 12, 1, 12, 2, 11, 1, 11, 1, 3, 11, 2, 11, 10, 1, 10, 10, 10, 1, 2, 2, 6, 1, 2, 1, 9, 10, 2, 9, 8, 1, 9, 9, 8, 1, 8, 2, 5, 8, 9, 1, 8, 1, 8, 3, 7, 1, 8, 9, 7, 8, 2, 8, 7, 8, 7, 1, 3, 7, 2, 7, 4, 7, 3, 8, 3, 1, 7, 2, 6, 7, 8, 1, 6, 4, 6, 7, 6, 1, 6, 1, 4, 1, 2, 3, 6, 7, 6, 6, 6
Offset: 1

Views

Author

Chia-Ching Chen, Oct 12 2024

Keywords

Comments

For these k = 4n-1, the first odd number is A139391(k) > k so it is the first record high.
The trajectory of k starts with A001511(n) successive initial records, so that a(n) >= A001511(n) (and reaches A351974(n) at that point).

Examples

			For n = 7, which corresponds to the Collatz trajectory started from 27, the trajectory reaches larger maximum odd numbers at the following points: 41, 47, 71, 107, 233, 263, 395, 593, 719, 1079, 1619, 2429, 3077. Since there are 14 instances where a new maximum odd number is reached, we have a(7)=14.
		

Crossrefs

Programs

  • Python
    def a(num:int) -> int:
        count = 0
        num = num * 4 - 1
        maxnum = num
        while num > 1:
            if num%2 == 1:
                num = num*3 + 1
            while num%2 == 0:
                num //= 2
            if num > maxnum:
                count += 1
                maxnum = num
        return count

Formula

a(n) = A376996(4n-1).
a(n) = A001511(n) + A376996(A351974(n)).
Showing 1-2 of 2 results.