A320262 Write n in binary, then modify each run of 0's and each run of 1's by appending a 0. a(n) is the decimal equivalent of the result.
2, 8, 6, 16, 34, 24, 14, 32, 66, 136, 70, 48, 98, 56, 30, 64, 130, 264, 134, 272, 546, 280, 142, 96, 194, 392, 198, 112, 226, 120, 62, 128, 258, 520, 262, 528, 1058, 536, 270, 544, 1090, 2184, 1094, 560, 1122, 568, 286, 192, 386, 776, 390, 784, 1570, 792, 398
Offset: 1
Examples
6 in binary is 110. Modify each run by appending a 0 to get 11000, which is 24 in decimal. So a(6) = 24.
Links
- Chai Wah Wu, Table of n, a(n) for n = 1..10000
- Chai Wah Wu, Record values in appending and prepending bitstrings to runs of binary digits, arXiv:1810.02293 [math.NT], 2018.
Programs
-
Mathematica
Array[FromDigits[Flatten@ Map[Append[#, 0] &, Split@ IntegerDigits[#, 2]], 2] &, 55] (* Michael De Vlieger, Nov 23 2018 *)
-
Python
from re import split def A320262(n): return int(''.join(d+'0' for d in split('(0+)|(1+)',bin(n)[2:]) if d != '' and d != None),2)
Formula
a(n) = 2*A320263(n).
a(4n) = 2*a(2n), a(4n+1) = 4*a(2n)+2, a(4n+2) = 4*a(2n+1) and a(4n+3) = 2*a(2n+1)+2. - Chai Wah Wu, Nov 21 2018
Comments