OFFSET
1,1
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
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
-- Reinhard Zumkeller, Jul 05 2013
(Python)
def a(n): return int(("0"+bin(n)[2:]).replace("01", "011"), 2)
print([a(n) for n in range(1, 61)]) # Michael S. Branicky, Jul 27 2022
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Dec 02 2009
EXTENSIONS
Extended by Ray Chandler, Dec 18 2009
STATUS
approved