OFFSET
1,1
COMMENTS
Iterating R on 4n-1 (n>=1) starts with an increasing trajectory before reaching the first maximum. However, iterating R on 4n-3 (n>=1) starts with a decreasing trajectory before reaching 1 or the first minimum.
FORMULA
EXAMPLE
For n = 1, iterating R on 4n-1=3 gives 3->5->1, in which the first maximum is 5, and thus a(0) = 5.
For n = 8, iterating R on 4n-1=31 gives 31->47->71->107->161->121->91->137->103->155->233->175...->23->35->53->5->1, in which the first maximum is 161, and thus a(8) = 161.
PROG
(Python)
def A351974(n): s = (n&-n).bit_length(); return 4*n*3**s//2**s - 1
(PARI) a(n) = my(s=valuation(n, 2)); n>>(s-1)*3^(s+1) - 1; \\ Kevin Ryde, Feb 28 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Ya-Ping Lu, Feb 26 2022
STATUS
approved