%I #12 Mar 11 2022 20:43:41
%S 1,11,2,21,111,12,3,31,121,1111,211,22,112,13,4,41,131,1121,221,2111,
%T 11111,1211,311,32,122,1112,212,23,113,14,5,51,141,1131,231,2121,
%U 11121,1221,321,3111
%N Take the binary expansion of n, starting with the least significant bit, and concatenate the lengths of the runs.
%C Obviously this compressed notation is useful only for n < 1023. A227736 is a version which works for all n.
%H 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 n, binary, run lengths, -> a(n)
%e 1, [1], [1] -> 1
%e 2, [0, 1], [1, 1] -> 11
%e 3, [1, 1], [2] -> 2
%e 4, [0, 0, 1], [2, 1] -> 21
%e 5, [1, 0, 1], [1, 1, 1] -> 111
%e 6, [0, 1, 1], [1, 2] -> 12
%e 7, [1, 1, 1], [3] -> 3
%e 8, [0, 0, 0, 1], [3, 1] -> 31,
%e ...
%o (Python)
%o from itertools import groupby
%o 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
%Y Cf. A227736, A101211, A318927.
%K nonn,base
%O 1,2
%A _N. J. A. Sloane_, Sep 09 2018
|