OFFSET
1,2
COMMENTS
A389240(n) is the number of steps to reach 1 when the sequence S starts with S(1) = n and is extended with S(m)/2 when S(m) is even, otherwise with S(m) + the smallest odd number not yet added.
EXAMPLE
Let s = A389240.
Table of n, a(n), and s(a(n)) for n <= 12:
n a(n) s(a(n))
--------------
1 1 0
2 2 1
3 3 3
4 5 8
5 10 9
6 13 33
7 26 34
8 52 35
9 61 96
10 122 97
11 244 98
12 381 120
MATHEMATICA
Lim=200000; s=Table[m = -1; If[#[[-1]] == 1, -1 + Length[#], -1] &@ If[n < 5, NestWhileList[If[EvenQ[#], #/2, # + (m += 2)] &, n, # > 1 &], NestWhileList[If[EvenQ[#], #/2, # + (m += 2)] &, n, And[#4 > 1, Nand[#1 == #3 - 2, #2 == #4 - 4]] &, 4]], {n, Lim}]; rec={0}; Ind={1}; Do[If[s[[n]]>rec[[-1]], AppendTo[rec, s[[n]]]; AppendTo[Ind, n]], {n, Lim}]; Ind
CROSSREFS
KEYWORD
nonn,more
AUTHOR
James C. McMahon, Oct 07 2025
EXTENSIONS
a(31)-a(35) from Sean A. Irvine, Oct 15 2025
STATUS
approved
