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 A318926 #24 Mar 17 2025 06:43:16 %S A318926 1,11,2,21,111,12,3,31,121,1111,211,22,112,13,4,41,131,1121,221,2111, %T A318926 11111,1211,311,32,122,1112,212,23,113,14,5,51,141,1131,231,2121, %U A318926 11121,1221,321,3111,12111,111111,21111,2211,11211,1311,411,42,132,1122,222,2112,11112,1212,312,33,123 %N A318926 Take the binary expansion of n, starting with the least significant bit, and concatenate the lengths of the runs. %C A318926 Obviously this compressed notation is useful only for n < 2047. A227736 is a version which works for all n. [Corrected by _M. F. Hasler_, Mar 12 2025] %H A318926 Paolo Xausa, <a href="/A318926/b318926.txt">Table of n, a(n) for n = 1..10000</a> %H A318926 Claude Lenormand, <a href="/A318921/a318921.pdf">Deux transformations sur les mots</a>, Preprint, 5 pages, Nov 17 2003. Apparently unpublished. This is a scanned copy of the version that the author sent to me in 2003. - _N. J. A. Sloane_, Sep 09 2018. See Procedure 1. %e A318926 n, binary, run lengths, -> a(n) %e A318926 1, [1], [1] -> 1 %e A318926 2, [0, 1], [1, 1] -> 11 %e A318926 3, [1, 1], [2] -> 2 %e A318926 4, [0, 0, 1], [2, 1] -> 21 %e A318926 5, [1, 0, 1], [1, 1, 1] -> 111 %e A318926 6, [0, 1, 1], [1, 2] -> 12 %e A318926 7, [1, 1, 1], [3] -> 3 %e A318926 8, [0, 0, 0, 1], [3, 1] -> 31, %e A318926 ... %e A318926 From _M. F. Hasler_, Mar 12 2025: (Start) %e A318926 For n = 1023 = 2^10-1, n = '1'*10 in binary, so there is only one run of length 10, whence a(n) = 10. This value cannot occur at any other index n. %e A318926 For n = 1024 = 2^10, n = '1'+'0'*10 in binary, so the run lengths, from right to left, are [10, 1], whence a(n) = 101. The only other index n for which this value occurs is n = 2^101-1. %e A318926 For n = 1025 = 2^10+1, n = '1'+'0'*9+'1' in binary, so a(n) = 191. This values occurs for the second time as a(n = 2^19), for the third time for a(n = 2^92-2), and for the 4th and last time as a(n = 2^191-1). %e A318926 Similarly, a(1026) = 1181 appears for the second time at n = 2^19 + 1 = 524289; %e A318926 a(1027) = 281 occurs a 2nd, 3rd and 4th time at n = 2^28, (2^81-1)*2 and 2^281-1. %e A318926 The first duplicate value occurs as a(2047 = 2^11-1) = 11 = a(2). (End) %t A318926 A318926[n_] := FromDigits[Flatten[IntegerDigits[Map[Length, Split[Reverse[IntegerDigits[n, 2]]]]]]]; %t A318926 Array[A318926, 100] (* _Paolo Xausa_, Mar 16 2025 *) %o A318926 (Python) %o A318926 from itertools import groupby %o A318926 def A318926(n): return int(''.join(str(len(list(g))) for k, g in groupby(bin(n)[:1:-1]))) # _Chai Wah Wu_, Mar 11 2022 %o A318926 (PARI) A318926(n)=eval(strjoin(Vecrev(A101211_row(n)))); \\ _M. F. Hasler_, Mar 11 2025 %Y A318926 Cf. A227736 (run lengths in rows instead of concatenation), A101211 (rows in reverse order), A318927 (concatenation in reverse order). %K A318926 nonn,base %O A318926 1,2 %A A318926 _N. J. A. Sloane_, Sep 09 2018 %E A318926 More terms from _M. F. Hasler_, Mar 12 2025