%I #11 Mar 16 2023 12:02:53
%S 1,1,1,1,2,1,2,1,2,3,1,3,1,3,2,1,2,3,4,3,4,1,4,3,2,3,4,3,2,3,2,1,2,3,
%T 4,6,6,5,6,6,4,5,1,5,6,5,4,3,2,6,6,1,6,5,6,6,1,6,4,6,2,3,2,1,2,3,4,6,
%U 12,5,12,3,12,10,6,10,4,10,12,6,4,5,6,10
%N a(n) is the number of integers whose binary expansions have the same multiset of run-lengths as that of n.
%C This sequence has similarities with A090706; here we consider multisets of run-lengths, there multisets of digits in binary expansions.
%H Rémy Sigrist, <a href="/A361477/b361477.txt">Table of n, a(n) for n = 0..8192</a>
%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F a(n) = 1 iff n = 0 or n belongs to A140690.
%e For n = 18:
%e - the binary expansion of 18 is "10010",
%e - the corresponding multiset of run-lengths is m = (1, 2, 1, 1),
%e - m has 4 terms: 3 times "1" and once "2",
%e - so a(18) = 4! / (3! * 1!) = 4.
%o (PARI) a(n) = { my (r=[]); while (n, my (v=valuation(n+n%2, 2)); n\=2^v; r=concat(v, r)); my (s=Set(r), f=vector(#s)); for (k=1, #r, f[setsearch(s, r[k])]++); (#r)! / prod(k=1, #f, f[k]!) }
%o (Python)
%o from math import factorial, prod
%o from itertools import groupby
%o from collections import Counter
%o def A361477(n): return factorial(len(c:=[len(list(g)) for k, g in groupby(bin(n)[2:])]))//prod(map(factorial,Counter(c).values())) # _Chai Wah Wu_, Mar 16 2023
%Y Cf. A090706, A101211, A140690.
%K nonn,base
%O 0,5
%A _Rémy Sigrist_, Mar 13 2023