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.

A090078 In binary expansion of n, reduce contiguous blocks of 0's to 0.

Original entry on oeis.org

0, 1, 2, 3, 2, 5, 6, 7, 2, 5, 10, 11, 6, 13, 14, 15, 2, 5, 10, 11, 10, 21, 22, 23, 6, 13, 26, 27, 14, 29, 30, 31, 2, 5, 10, 11, 10, 21, 22, 23, 10, 21, 42, 43, 22, 45, 46, 47, 6, 13, 26, 27, 26, 53, 54, 55, 14, 29, 58, 59, 30, 61, 62, 63, 2, 5, 10, 11, 10, 21, 22, 23, 10, 21
Offset: 0

Views

Author

Reinhard Zumkeller, Nov 20 2003

Keywords

Examples

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

Crossrefs

Programs

  • Mathematica
    a[n_] := FromDigits[Flatten[Split[IntegerDigits[n, 2]] /. x_List /; x[[1]] == 0 -> {0}], 2]; Array[a, 100, 0] (* Amiram Eldar, Jul 30 2025 *)
  • PARI
    a(n)=my(v=binary(n),t); for(i=1,#v, if(v[i], t+=t+1, t%2, t+=t)); t \\ Charles R Greathouse IV, Aug 17 2016
    
  • Python
    def a(n):
        b = bin(n)[2:]
        while "00" in b: b = b.replace("00", "0")
        return int(b, 2)
    print([a(n) for n in range(81)]) # Michael S. Branicky, Jul 27 2022

Formula

a(a(n)) = a(n).
a(A090077(n)) = A090077(a(n)) = A090079(n).