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.

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

This page as a plain text file.
%I A376996 #24 Oct 31 2024 01:50:18
%S A376996 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,
%T A376996 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,
%U A376996 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
%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.
%C A376996 Similar to A334040, but only count when it comes to a new larger odd number.
%e A376996 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.
%e A376996 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).
%e A376996 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.
%o A376996 (Python)
%o A376996 def a(num:int) -> int:
%o A376996     count = 0
%o A376996     maxnum = num
%o A376996     while num > 1:
%o A376996         if num%2 == 1:
%o A376996             num = num*3 + 1
%o A376996         while num%2 == 0:
%o A376996             num //= 2
%o A376996         if num > maxnum:
%o A376996             count += 1
%o A376996             maxnum = num
%o A376996     return count
%Y A376996 Cf. A006370, A139391, A334040.
%K A376996 nonn
%O A376996 1,7
%A A376996 _Chia-Ching Chen_, Oct 12 2024