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.

A361479 a(n) is the least integer whose binary expansion has the same multiset of run-lengths as that of n.

This page as a plain text file.
%I A361479 #9 Mar 16 2023 12:05:31
%S A361479 0,1,2,3,4,5,4,7,8,9,10,9,12,9,8,15,16,17,18,19,18,21,18,17,24,19,18,
%T A361479 19,24,17,16,31,32,33,34,35,36,37,36,35,34,37,42,37,36,37,34,33,48,35,
%U A361479 36,51,36,37,36,35,56,35,34,35,48,33,32,63,64,65,66,67
%N A361479 a(n) is the least integer whose binary expansion has the same multiset of run-lengths as that of n.
%H A361479 Rémy Sigrist, <a href="/A361479/b361479.txt">Table of n, a(n) for n = 0..8192</a>
%H A361479 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A361479 a(a(n)) = a(n).
%F A361479 a(n) <= n with equality iff n = 0 or belongs to A175020.
%o A361479 (PARI) a(n) = { my (r=[]); while (n, my (v=valuation(n+n%2, 2)); n\=2^v; r=concat(v, r)); r=vecsort(r); my (h=0, t=#r+1, v=0); for (k=1, #r, v=(v+k%2)*2^if (k%2, r[h++], r[t--])-k%2;); return (v); }
%Y A361479 Cf. A073137, A361478, A361480.
%K A361479 nonn,base
%O A361479 0,3
%A A361479 _Rémy Sigrist_, Mar 13 2023