cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A175048 Write n in binary, then increase each run of 1's by one 1. a(n) is the decimal equivalent of the result.

Original entry on oeis.org

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
Offset: 1

Views

Author

Leroy Quet, Dec 02 2009

Keywords

Examples

			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.
		

Crossrefs

Programs

  • 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
    
  • Mathematica
    Table[FromDigits[Flatten[If[MemberQ[#,1],Join[{1},#],#]&/@ Split[ IntegerDigits[ n,2]]],2],{n,60}] (* Harvey P. Dale, Oct 10 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

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

Extensions

Extended by Ray Chandler, Dec 18 2009