A371094 a(n) = m*(2^e) + ((4^e)-1)/3, where m = 3n+1, and e is the 2-adic valuation of m.
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
Offset: 0
Examples
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
Links
- Antti Karttunen, Table of n, a(n) for n = 0..16384
- Michael De Vlieger, Plot binary expansion of a(n) arranged with smallest bit at bottom and largest at top, n increasing from left to right for n = 0..3071. Black indicates 1, white indicates 0.
- Index entries for sequences related to 3x+1 (or Collatz) problem
- Index entries for sequences related to binary expansion of n
Crossrefs
Programs
-
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 *)
-
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
Comments