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.

User: Chia-Ching Chen

Chia-Ching Chen's wiki page.

Chia-Ching Chen has authored 3 sequences.

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

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)).

A376996 Number of odd terms in the Collatz trajectory of n which are > n and are a new record high among its odd terms.

Original entry on oeis.org

0, 0, 1, 0, 0, 0, 2, 0, 2, 0, 1, 0, 0, 1, 3, 0, 0, 0, 1, 0, 0, 0, 2, 0, 1, 0, 14, 0, 0, 2, 13, 0, 0, 0, 1, 0, 0, 0, 3, 0, 13, 0, 1, 0, 0, 1, 12, 0, 0, 0, 1, 0, 0, 12, 12, 0, 1, 0, 2, 0, 0, 12, 11, 0, 0, 0, 1, 0, 0, 0, 11, 0, 12, 0, 1, 0, 0, 2, 3, 0, 0, 11, 11, 0, 0, 0, 2, 0, 1, 0, 11, 0, 0, 11, 10, 0, 11, 0, 1, 0
Offset: 1

Author

Chia-Ching Chen, Oct 12 2024

Keywords

Comments

Similar to A334040, but only count when it comes to a new larger odd number.

Examples

			For n=15, a 4k-1 term, its trajectory is 15, 46, (23), 70, (35), 106, (53), 160, 80, 40, 20, 10, 5, 1. The numbers in the parentheses are numbers which make larger odd numbers. There are 3 of them, so a(15) = 3.
For n=9, a 4k+1 term, its trajectory is 9, 28, 14, 7, 22, (11), 34, (17), 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1. There are 2 new largest odd terms, so a(9) = 2. It is noticeable that before the first new largest odd term 11, it reaches 7, which is a 4k-1 term smaller than 9, so a(9) = a(7).
For n=10, a 2k term, its trajectory is 10, 5, 16, 8, 4, 2, 1. There are no odd terms > 10, so a(10) = 0.
		

Crossrefs

Programs

  • Python
    def a(num:int) -> int:
        count = 0
        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

A306323 Break up the Kolakoski sequence A000002 into pieces by inserting a space between every pair of equal terms; sequence gives lengths of successive pieces.

Original entry on oeis.org

2, 2, 4, 3, 2, 3, 2, 4, 4, 2, 3, 4, 3, 2, 4, 4, 3, 2, 3, 2, 4, 3, 2, 3, 4, 4, 2, 3, 2, 4, 3, 2, 3, 2, 4, 4, 3, 2, 3, 4, 2, 3, 2, 4, 3, 2, 3, 2, 4, 4, 2, 3, 4, 3, 2, 3, 2, 4, 4, 3, 2, 4, 4, 2, 3, 4, 4, 2, 3, 2, 4, 3, 2, 3, 4, 2, 3, 2, 3, 4, 4, 2, 3, 2, 4, 3, 2, 3, 4, 4, 2, 3, 4, 3, 2, 4, 4, 3, 2, 3, 4, 2, 3, 2, 4, 3, 2, 3
Offset: 1

Author

Chia-Ching Chen, Mar 25 2019

Keywords

Comments

The first 14 terms of Kolakoski's sequence are 1,2,2,1,1,2,1,2,2,1,2,2. When we break it into pieces, inserting a pair of parentheses between every two identical terms, we get (1,2),(2,1),(1,2,1,2),(2,1,2),..., and the lengths of the pieces form this sequence 2,2,4,3,...
This sequence only contains 2, 3 and 4. Proof: Considering 1, it would be 1,(1),1 or 2,(2),2 in Kolakoski's sequence, which is impossible because there would be a 3 (or more) in former terms. And for 5 (or more), it would be 1,(1,2,1,2,1),1 (or similar to start with 2), where the terms which generate it would be 2+,1,1,1,2+, where three consecutive terms can't happen according to the former proof.
Except for the first two terms, two consecutive terms cannot be equal unless they're 4. Proof: Considering 2's, the terms in Kolakoski's sequence would be 1,1,2,2,1,1, which would be generated by 2,2,2. And for 3's, the terms in Kolakoski's sequence would be 1,1,2,1,1,2,1,1, which would be generated by 2,1,2,1,2, whose 2nd through 4th terms would be generated by 1,1,1.

Examples

			Kolakoski's sequence separated into pieces:
(1,2), (2,1), (1,2,1,2), (2,1,2), (2,1), (1,2,1), (1,2), (2,1,2,1), (1,2,1,2), (2,1), (1,2,1), (1,2,1,2), (2,1,2), (2,1), (1,2,1,2), (2,1,2,1), (1,...
so we get
2, 2, 4, 3, 2, 3, 2, 4, 4, 2, 3, 4, 3, 2, 4, 4, ...
		

Crossrefs

Cf. A000002.

Programs

  • Python
    # See A000002 for the definition of Kolakoski()
    def a306323():
        last = count = 0
        for k in Kolakoski():
            if k is last:
                yield count
                count = 0
            count += 1
            last = k
    from itertools import islice
    print(*list(islice(a306323(), 108)), sep=', ')
    # corrected by David Radcliffe, May 10 2025