|
|
A175048
|
|
Write n in binary, then increase each run of 1's by one 1. a(n) is the decimal equivalent of the result.
|
|
6
|
|
|
3, 6, 7, 12, 27, 14, 15, 24, 51, 54, 55, 28, 59, 30, 31, 48, 99, 102, 103, 108, 219, 110, 111, 56, 115, 118, 119, 60, 123, 62, 63, 96, 195, 198, 199, 204, 411, 206, 207, 216, 435, 438, 439, 220, 443, 222, 223, 112, 227, 230, 231, 236, 475, 238, 239, 120, 243, 246
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
FORMULA
|
a(2^n) = 3*2^n. a(4n) = 2*a(2n), a(4n+1) = 4*a(2n)+3, a(4n+2) = 2*a(2n+1), a(4n+3) = 2*a(2n+1)+1. - Chai Wah Wu, Nov 21 2018
|
|
EXAMPLE
|
12 in binary is 1100. Increase each run of 1 by one digit to get 11100, which is 28 in decimal. So a(12) = 28.
|
|
MATHEMATICA
|
Table[FromDigits[Flatten[If[MemberQ[#, 1], Join[{1}, #], #]&/@ Split[ IntegerDigits[ n, 2]]], 2], {n, 60}] (* Harvey P. Dale, Oct 10 2013 *)
|
|
PROG
|
(Haskell)
import Data.List (group)
a175048 = foldr (\b v -> 2 * v + b) 0 . concatMap
(\bs@(b:_) -> if b == 1 then 1 : bs else bs) . group . a030308_row
(Python)
def a(n): return int(("0"+bin(n)[2:]).replace("01", "011"), 2)
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|