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.

This page as a plain text file.
%I A090078 #23 Jul 30 2025 01:00:13
%S A090078 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,
%T A090078 27,14,29,30,31,2,5,10,11,10,21,22,23,10,21,42,43,22,45,46,47,6,13,26,
%U A090078 27,26,53,54,55,14,29,58,59,30,61,62,63,2,5,10,11,10,21,22,23,10,21
%N A090078 In binary expansion of n, reduce contiguous blocks of 0's to 0.
%H A090078 Amiram Eldar, <a href="/A090078/b090078.txt">Table of n, a(n) for n = 0..10000</a>
%H A090078 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>.
%F A090078 a(a(n)) = a(n).
%F A090078 a(A090077(n)) = A090077(a(n)) = A090079(n).
%e A090078 100 -> '1100100' -> 11[00]1[00] -> 11[0]1[0] -> '11010' -> 26=a(100).
%t A090078 a[n_] := FromDigits[Flatten[Split[IntegerDigits[n, 2]] /. x_List /; x[[1]] == 0 -> {0}], 2]; Array[a, 100, 0] (* _Amiram Eldar_, Jul 30 2025 *)
%o A090078 (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
%o A090078 (Python)
%o A090078 def a(n):
%o A090078     b = bin(n)[2:]
%o A090078     while "00" in b: b = b.replace("00", "0")
%o A090078     return int(b, 2)
%o A090078 print([a(n) for n in range(81)]) # _Michael S. Branicky_, Jul 27 2022
%Y A090078 Cf. A090077, A090079, A007088.
%K A090078 nonn,base,easy
%O A090078 0,3
%A A090078 _Reinhard Zumkeller_, Nov 20 2003