login
A175047
Write n in binary, then increase each run of 0's by one 0. a(n) is the decimal equivalent of the result.
10
1, 4, 3, 8, 9, 12, 7, 16, 17, 36, 19, 24, 25, 28, 15, 32, 33, 68, 35, 72, 73, 76, 39, 48, 49, 100, 51, 56, 57, 60, 31, 64, 65, 132, 67, 136, 137, 140, 71, 144, 145, 292, 147, 152, 153, 156, 79, 96, 97, 196, 99, 200, 201, 204, 103, 112, 113, 228, 115, 120, 121, 124, 63, 128
OFFSET
1,2
COMMENTS
From Reinhard Zumkeller, Dec 12 2009: (Start)
A070939(a(n)) = A070939(n) + A033264(n);
A171598 and A171599 give record values and where they occur. (End)
LINKS
FORMULA
a(n) = if n<2 then n else 2*(1 + 0^((n+2) mod 4))*a([n/2]) + n mod 2. - Reinhard Zumkeller, Jan 20 2010
a(2^n) = 2^(n+1). - Chai Wah Wu, Nov 21 2018
EXAMPLE
12 in binary is 1100. Increase each run of 0 by one digit to get 11000, which is 24 in decimal. So a(12) = 24.
MATHEMATICA
f[n_] := Block[{s = Split@ IntegerDigits[n, 2]}, FromDigits[ Flatten@ Insert[s, {0}, Table[{2 i}, {i, Floor[ Length@s/2]} ]], 2]]; Arrar[ f, 64] (* Robert G. Wilson v, Dec 11 2009 *)
PROG
(Haskell)
import Data.List (group)
a175047 = foldr (\b v -> 2 * v + b) 0 . concatMap
(\bs@(b:_) -> if b == 0 then 0 : bs else bs) . group . a030308_row
-- Reinhard Zumkeller, Jul 05 2013
(Python)
from re import split
def A175047(n):
return int(''.join(d+'0' if '0' in d else d for d in split('(0+)|(1+)', bin(n)[2:]) if d != '' and d != None), 2) # Chai Wah Wu, Nov 21 2018
CROSSREFS
Cf. A084471. - Robert G. Wilson v, Dec 11 2009
Sequence in context: A240969 A198576 A368551 * A316688 A309517 A105185
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Dec 02 2009
EXTENSIONS
Extended by Ray Chandler, Dec 18 2009
a(11) onwards from Robert G. Wilson v and Reinhard Zumkeller, Dec 11 2009
STATUS
approved