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.

A090079 In binary expansion of n: reduce contiguous blocks of 0's to 0 and contiguous blocks of 1's to 1.

Original entry on oeis.org

0, 1, 2, 1, 2, 5, 2, 1, 2, 5, 10, 5, 2, 5, 2, 1, 2, 5, 10, 5, 10, 21, 10, 5, 2, 5, 10, 5, 2, 5, 2, 1, 2, 5, 10, 5, 10, 21, 10, 5, 10, 21, 42, 21, 10, 21, 10, 5, 2, 5, 10, 5, 10, 21, 10, 5, 2, 5, 10, 5, 2, 5, 2, 1, 2, 5, 10, 5, 10, 21, 10, 5, 10, 21, 42, 21, 10, 21, 10, 5, 10, 21, 42, 21
Offset: 0

Views

Author

Reinhard Zumkeller, Nov 20 2003

Keywords

Comments

a(a(n))=a(n); a(n)=A090078(A090077(n))=A090077(A090078(n)).
All terms are without consecutive equal binary digits: a(A000975(n)) = A000975(n) and a(m) <> A000975(n) for m < A000975(n). - Reinhard Zumkeller, Feb 16 2013

Examples

			100 -> '1100100' -> [11][00][1][00] -> [1][0][1][0] -> '1010' ->
10=a(100).
		

Crossrefs

Programs

  • Haskell
    a090079 = foldr (\b v -> 2 * v + b) 0 . map head . group . a030308_row
    -- Reinhard Zumkeller, Feb 16 2013
    
  • Mathematica
    Table[FromDigits[#, 2] &@ Map[First, Split@ IntegerDigits[n, 2]], {n, 0, 83}] (* Michael De Vlieger, Dec 12 2016 *)
    FromDigits[Split[IntegerDigits[#,2]][[All,1]],2]&/@Range[0,90] (* Harvey P. Dale, Oct 10 2017 *)
  • Python
    from itertools import groupby
    def a(n): return int("".join(k for k, g in groupby(bin(n)[2:])), 2)
    print([a(n) for n in range(84)]) # Michael S. Branicky, Jul 23 2022

Formula

Conjecture: a(n) = (2^(A005811(n)+1) + (1-(-1)^n)/2 - 2)/3. - Velin Yanev, Dec 12 2016