login
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.
4
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, 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, 6, 7, 5, 4, 3, 3, 16, 5, 18, 5, 2, 5, 5, 7, 6, 2, 4, 18, 17
OFFSET
1,6
COMMENTS
The 2->1 step is not counted.
From Dustin Theriault, May 24 2023: (Start)
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).
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)
Number of steps x -> A363270(x) to go from n to 1. - Dustin Theriault, Jul 09 2023
FORMULA
From Alan Michael Gómez Calderón, Mar 19 2025: (Start)
a(n) = A346965(A000265(n)) - (n mod 2) + 1;
a(n) = a(A363270(n)) + 1 for n >= 2. (End)
EXAMPLE
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.
MATHEMATICA
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 *)
PROG
(C) int a(int n) {
int steps = 0;
while (n > 1) {
while (n & 1) n += (n >> 1) + 1;
while (!(n & 1)) n >>= 1;
++steps;
}
return steps;
} /* Dustin Theriault, May 23 2023 */
CROSSREFS
KEYWORD
nonn
AUTHOR
Brenton Bostick (bostick(AT)gmail.com), May 18 2009
STATUS
approved