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.

A160541 Number of odd-then-even runs to reach 1 from n under the modified "3x+1" map: x -> x/2 if x is even, x -> (3x+1)/2 if x is odd.

This page as a plain text file.
%I A160541 #58 Mar 27 2025 10:14:45
%S A160541 0,1,1,1,1,2,3,1,4,2,3,2,2,4,2,1,3,5,4,2,1,4,2,2,5,3,17,4,4,3,16,1,6,
%T A160541 4,2,5,4,5,6,2,17,2,6,4,4,3,16,2,5,6,5,3,2,18,17,4,7,5,6,3,3,17,15,1,
%U A160541 6,7,5,4,3,3,16,5,18,5,2,5,5,7,6,2,4,18,17
%N A160541 Number of odd-then-even runs to reach 1 from n under the modified "3x+1" map: x -> x/2 if x is even, x -> (3x+1)/2 if x is odd.
%C A160541 The 2->1 step is not counted.
%C A160541 From _Dustin Theriault_, May 24 2023: (Start)
%C A160541 The ratio of the partial sum of a(n) to the partial sum of A006577(n) appears to approach 1/6 (observation for n = 1..10^10).
%C A160541 The ratio of the partial sum of a(n) to the partial sum of A286380(n) appears to approach 1/2 (observation for n = 1..10^10). (End)
%C A160541 Number of steps x -> A363270(x) to go from n to 1. - _Dustin Theriault_, Jul 09 2023
%H A160541 Michael De Vlieger, <a href="/A160541/b160541.txt">Table of n, a(n) for n = 1..10000</a>
%H A160541 Francis Laclé, <a href="https://hal.archives-ouvertes.fr/hal-03201180v2">2-adic parity explorations of the 3n+1 problem</a>, hal-03201180v2 [cs.DM], 2021.
%H A160541 Dustin Theriault, <a href="/A160541/a160541.png">Ratio between the partial sum of a(n) to the partial sum of A006577(n), for n = 1..10^10</a>.
%H A160541 Dustin Theriault, <a href="/A160541/a160541_2.png">Ratio between the partial sum of  a(n) to the partial sum of A286380(n), for n = 1..10^10</a>.
%H A160541 Dustin Theriault, <a href="/A160541/a160541_1.png">Histogram of a(n), for n = 1..10^10</a>.
%H A160541 Dustin Theriault, <a href="/A160541/a160541_3.png">Combined histograms of A006577, A286380, A160541, for n = 1..10^9</a>.
%F A160541 From _Alan Michael Gómez Calderón_, Mar 19 2025: (Start)
%F A160541 a(n) = A346965(A000265(n)) - (n mod 2) + 1;
%F A160541 a(n) = a(A363270(n)) + 1 for n >= 2. (End)
%e A160541 7->11->17->26->13->20->10->5->8->4->2->1, so the odd-then-even runs are (7->11->17->26) (13->20->10) (5->8->4->2), and a(7) is 3.
%t A160541 Array[Length@ Split[Most@ NestWhileList[If[EvenQ@ #, #/2, (3 # + 1)/2] &, #, # > 1 &], Or[OddQ[#1], EvenQ[#2]] &] &, 120] (* Corrected by _Michael De Vlieger_, Jul 19 2021 *)
%o A160541 (C) int a(int n) {
%o A160541   int steps = 0;
%o A160541   while (n > 1) {
%o A160541     while (n & 1) n += (n >> 1) + 1;
%o A160541     while (!(n & 1)) n >>= 1;
%o A160541     ++steps;
%o A160541   }
%o A160541   return steps;
%o A160541 } /* _Dustin Theriault_, May 23 2023 */
%Y A160541 Cf. A006577, A286380, A363270.
%K A160541 nonn
%O A160541 1,6
%A A160541 Brenton Bostick (bostick(AT)gmail.com), May 18 2009