cp's OEIS Frontend

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.

A361477 a(n) is the number of integers whose binary expansions have the same multiset of run-lengths as that of n.

This page as a plain text file.
%I A361477 #11 Mar 16 2023 12:02:53
%S A361477 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 A361477 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 A361477 12,5,12,3,12,10,6,10,4,10,12,6,4,5,6,10
%N A361477 a(n) is the number of integers whose binary expansions have the same multiset of run-lengths as that of n.
%C A361477 This sequence has similarities with A090706; here we consider multisets of run-lengths, there multisets of digits in binary expansions.
%H A361477 Rémy Sigrist, <a href="/A361477/b361477.txt">Table of n, a(n) for n = 0..8192</a>
%H A361477 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A361477 a(n) = 1 iff n = 0 or n belongs to A140690.
%e A361477 For n = 18:
%e A361477 - the binary expansion of 18 is "10010",
%e A361477 - the corresponding multiset of run-lengths is m = (1, 2, 1, 1),
%e A361477 - m has 4 terms: 3 times "1" and once "2",
%e A361477 - so a(18) = 4! / (3! * 1!) = 4.
%o A361477 (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 A361477 (Python)
%o A361477 from math import factorial, prod
%o A361477 from itertools import groupby
%o A361477 from collections import Counter
%o A361477 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 A361477 Cf. A090706, A101211, A140690.
%K A361477 nonn,base
%O A361477 0,5
%A A361477 _Rémy Sigrist_, Mar 13 2023