login
a(n) = LCM of run lengths in binary representation of n.
6

%I #17 Oct 15 2022 14:09:00

%S 1,1,1,2,2,1,2,3,3,2,1,2,2,2,3,4,4,3,2,2,2,1,2,3,6,2,2,2,6,3,4,5,5,4,

%T 3,6,2,2,2,6,3,2,1,2,2,2,3,4,4,6,2,2,2,2,2,6,3,6,3,6,4,4,5,6,6,5,4,4,

%U 6,3,6,3,6,2,2,2,2,2,6,4,4,3,2,2,2,1,2,3,6,2,2,2,6,3,4,5,10,4,6,6,2,2,2,6,6,2,2,2,2,2,6,4,12,3,6,6,6,3,6,3

%N a(n) = LCM of run lengths in binary representation of n.

%H Antti Karttunen, <a href="/A284559/b284559.txt">Table of n, a(n) for n = 0..10922</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%H <a href="/index/Lc#lcm">Index entries for sequences related to lcm's</a>

%F a(n) = A167489(n) / A284558(n).

%e For n=12, A007088(12) = "1100" in binary, the run lengths are [2,2], thus a(12) = lcm(2,2) = 2.

%o (Scheme)

%o (define (A284559 n) (apply lcm (binexp->runcount1list n)))

%o ;; Or:

%o (define (A284559 n) (reduce lcm 1 (binexp->runcount1list n))) ;; For binexp->runcount1list, see the Program section of A227349.

%o (Python)

%o from math import lcm

%o from itertools import groupby

%o def a(n): return lcm(*(len(list(g)) for k, g in groupby(bin(n)[2:])))

%o print([a(n) for n in range(87)]) # _Michael S. Branicky_, Oct 15 2022

%Y Cf. A000975 (positions of ones).

%Y Cf. A007088, A167489, A227349, A284558, A284569, A284579.

%K nonn,base

%O 0,4

%A _Antti Karttunen_, Apr 14 2017