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.
%I A318927 #22 Aug 21 2025 08:45:07 %S A318927 1,11,2,12,111,21,3,13,121,1111,112,22,211,31,4,14,131,1211,122,1112, %T A318927 11111,1121,113,23,221,2111,212,32,311,41,5,15,141,1311,132,1212, %U A318927 12111,1221,123,1113 %N A318927 Take the binary expansion of n, starting with the most significant bit, and concatenate the lengths of the runs. %C A318927 Obviously this compressed notation is useful only for n < 1023. A101211 is a version which works for all n. %H A318927 Rémy Sigrist, <a href="/A318927/b318927.txt">Table of n, a(n) for n = 1..1022</a> %e A318927 n, binary, run lengths, -> a(n) %e A318927 1, [1], [1] -> 1 %e A318927 2, [1, 0], [1, 1] -> 11 %e A318927 3, [1, 1], [2] -> 2 %e A318927 4, [1, 0, 0], [1, 2] -> 12 %e A318927 5, [1, 0, 1], [1, 1, 1] -> 111 %e A318927 6, [1, 1, 0], [2, 1] -> 21 %e A318927 7, [1, 1, 1], [3] -> 3 %e A318927 ... %t A318927 Array[FromDigits@ Flatten[IntegerDigits@ Length[#] & /@ Split@ IntegerDigits[#, 2]] &, 40] (* _Michael De Vlieger_, Feb 17 2022 *) %o A318927 (PARI) a(n) = { my(d=[], r); while(n, n>>=r=valuation(n+n%2, 2); d=concat(digits(r), d)); fromdigits(d) } \\ _Rémy Sigrist_, Feb 17 2022, edited by _M. F. Hasler_, Mar 11 2025 %o A318927 (Python) %o A318927 from itertools import groupby %o A318927 def A318927(n): return int(''.join(str(len(list(g))) for k, g in groupby(bin(n)[2:]))) # _Chai Wah Wu_, Mar 11 2022 %Y A318927 Cf. A101211 (without concatenation, as rows), A227736 (rows reversed), A318926 (reverse concatenation). %Y A318927 Cf. A382255 (Heinz numbers instead of concatenation of the run lengths). %K A318927 nonn,base %O A318927 1,2 %A A318927 _N. J. A. Sloane_, Sep 09 2018