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.

A258055 Concatenation of the decimal representations of the lengths (increased by 1) of the runs of zeros between successive ones in the binary representation of n.

This page as a plain text file.
%I A258055 #29 Feb 21 2021 03:36:26
%S A258055 0,0,0,1,0,2,1,11,0,3,2,21,1,12,11,111,0,4,3,31,2,22,21,211,1,13,12,
%T A258055 121,11,112,111,1111,0,5,4,41,3,32,31,311,2,23,22,221,21,212,211,2111,
%U A258055 1,14,13,131,12,122,121,1211,11,113,112,1121,111,1112,1111
%N A258055 Concatenation of the decimal representations of the lengths (increased by 1) of the runs of zeros between successive ones in the binary representation of n.
%C A258055 Originally called the "Golden Book's ZI-sequence" by the author.
%C A258055 The ZI-sequence is related to the binary numbers sequence with 10 ^ n substituted by the respective exponent increased by 1 (i.e., 10 as 2, 100 as 3, etc.) and the least significant bit discarded, e.g., binary 1011 converts to ZI 21.
%C A258055 a(n) = 0 when no successive ones exist in the binary representation of n, i.e., when n=0 and when n is a power of 2. - _Giovanni Resta_, Aug 31 2015
%H A258055 A. Strazds, <a href="http://www.zime.lv/book/?oeis">The Golden Book</a> [broken link]
%e A258055 Example for n=6: binary 110 => split into 10^m components: 1 (10^0) and 10 (10^1) => 1; the least significant bit, and thus the whole last component, here 10, is discarded.
%e A258055 840 in binary is 1100101000. The runs of zeros between successive ones have length 0, 2 and 1, hence a(840) = 132. - _Giovanni Resta_, Aug 31 2015
%t A258055 a[0] = 0; a[n_] := FromDigits@ Flatten[ IntegerDigits /@ Most[ Length /@ (Split[ Flatten[ IntegerDigits[n, 2] /. 1 -> {1, 0}]][[2 ;; ;; 2]]) ]]; Table[a@ n, {n, 0, 100}] (* _Giovanni Resta_, Aug 31 2015 *)
%o A258055 (PHP)
%o A258055 function dec2zi ($d) {
%o A258055 $b = base_convert($d, 10, 2); $b = str_split($b);
%o A258055 $i = $z = 0; $r = "";
%o A258055 foreach($b as $v) {
%o A258055 if (!$v) {
%o A258055 $i++;
%o A258055 } else {
%o A258055 if ($i > 0) {
%o A258055 $r .= $i + $v; $i = 0;
%o A258055 } else {
%o A258055 if ($z > 0) {
%o A258055 $r .= $v; $z = 0;
%o A258055 }
%o A258055 $z++; }}}
%o A258055 return $r == "" ? 0 : $r; }
%Y A258055 Cf. A248646, A256494. See also A261300 for another version.
%K A258055 nonn,base,easy
%O A258055 0,6
%A A258055 _Armands Strazds_, May 17 2015