|
|
A371094
|
|
a(n) = m*(2^e) + ((4^e)-1)/3, where m = 3n+1, and e is the 2-adic valuation of m.
|
|
29
|
|
|
1, 21, 7, 21, 13, 341, 19, 45, 25, 117, 31, 69, 37, 341, 43, 93, 49, 213, 55, 117, 61, 5461, 67, 141, 73, 309, 79, 165, 85, 725, 91, 189, 97, 405, 103, 213, 109, 1877, 115, 237, 121, 501, 127, 261, 133, 1109, 139, 285, 145, 597, 151, 309, 157, 5461, 163, 333, 169, 693, 175, 357, 181, 1493, 187, 381, 193, 789, 199
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
COMMENTS
|
Construction: take the binary expansion of 3n+1 (A016777(n)), and substitute "01" for all trailing 0-bits that follow after its odd part (= A067745(1+n)), of which there are A371093(n) in total. See the examples.
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
For n=1, 3*n+1 = 4, "100" in binary, when we substitute 01's for the two trailing 0's, we obtain 21, "10101" in binary, therefore a(1) = 21.
For n=6, 3*6+1 = 19, "10011" in binary, and there are no trailing 0's, and no changes, therefore a(6) = 19.
For n=7, 3*7+1 = 22, "10110" in binary, with one trailing 0, which when replaced with 01 gives us 45, "101101" in binary, therefore a(7) = 45.
For n=229, there are e=4 trailing bit expansions 0 -> 01,
3n+1 = binary 101011 0 0 0 0
a(n) = binary 101011 01010101
|
|
MATHEMATICA
|
Array[#2*(2^#3) + ((4^#3) - 1)/3 & @@ {#1, #2, IntegerExponent[#2, 2]} & @@ {#, 3 #1 + 1} &, 67, 0] (* Michael De Vlieger, Apr 19 2024 *)
|
|
PROG
|
(PARI) A371094(n) = { my(m=1+3*n, e=valuation(m, 2)); ((m*(2^e)) + (((4^e)-1)/3)); };
(Python)
def A371094(n): return ((m:=3*n+1)<<(e:=(~m & m-1).bit_length()))+((1<<(e<<1))-1)//3 # Chai Wah Wu, Apr 28 2024
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|