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.
%I A209859 #28 Jul 27 2025 18:01:03 %S A209859 0,1,1,3,1,2,3,7,1,2,2,5,3,6,7,15,1,2,2,5,2,4,5,11,3,6,6,13,7,14,15, %T A209859 31,1,2,2,5,2,4,5,11,2,4,4,9,5,10,11,23,3,6,6,13,6,12,13,27,7,14,14, %U A209859 29,15,30,31,63,1,2,2,5,2,4,5,11,2,4,4,9,5,10,11,23,2,4,4,9,4,8,9,19,5,10,10,21,11,22,23,47,3,6,6,13,6,12,13,27,6,12,12,25,13 %N A209859 Rewrite the binary expansion of n from the most significant end, 1 -> 1, 0+1 (one or more zeros followed by one) -> 0, drop the trailing zeros of the original n. %C A209859 This is the number k such that the k-th composition in standard order is the reversed sequence of lengths of the maximal anti-runs of the binary indices of n. Here, the binary indices of n are row n of A048793, and the k-th composition in standard order is row k of A066099. For example, the binary indices of 100 are {3,6,7}, with maximal anti-runs ((3,6),(7)), with reversed lengths (1,2), which is the 6th composition in standard order, so a(100) = 6. - _Gus Wiseman_, Jul 27 2025 %H A209859 Gus Wiseman, <a href="https://docs.google.com/document/d/e/2PACX-1vTCPiJVFUXN8IqfLlCXkgP15yrGWeRhFS4ozST5oA4Bl2PYS-XTA3sGsAEXvwW-B0ealpD8qnoxFqN3/pub">Statistics, classes, and transformations of standard compositions</a> %F A209859 a(n) = a(A000265(n)). %e A209859 102 in binary is 1100110, we rewrite it from the left so that first two 1's stay same ("11"), then "001" is rewritten to "0", the last 1 to "1", and we ignore the last 0, thus getting 1101, which is binary expansion of 13, thus a(102) = 13. %t A209859 bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1]; %t A209859 stcinv[q_]:=Total[2^(Accumulate[Reverse[q]])]/2; %t A209859 Table[stcinv[Reverse[Length/@Split[bpe[n],#2!=#1+1&]]],{n,0,100}] (* _Gus Wiseman_, Jul 25 2025 *) %o A209859 (Scheme) (define (A209859 n) (let loop ((n n) (s 0) (i (A053644 n))) (cond ((zero? n) s) ((> i n) (if (> (/ i 2) n) (loop n s (/ i 2)) (loop (- n (/ i 2)) (* 2 s) (/ i 4)))) (else (loop (- n i) (+ (* 2 s) 1) (/ i 2)))))) %o A209859 (Python) %o A209859 import re %o A209859 def a(n): return int(re.sub("0+1", "0", bin(n)[2:].rstrip("0")), 2) if n else 0 %o A209859 print([a(n) for n in range(109)]) # _Michael S. Branicky_, Jul 25 2025 %Y A209859 This is an "inverse" of A071162, i.e. a(A071162(n)) = n for all n. Bisection: A209639. Used to construct permutation A209862. %Y A209859 Removing duplicates appears to give A358654. %Y A209859 Sorted positions of firsts appearances appear to be A247648+1. %Y A209859 A245563 lists run-lengths of binary indices (ranks A246029), reverse A245562. %Y A209859 A384175 counts subsets with all distinct lengths of maximal runs, complement A384176. %Y A209859 Cf. A000120, A023758, A029931, A044813, A048793, A052499, A069010, A348366, A384878, A384879, A384893. %Y A209859 Cf. A384877, A385816, A385887, A385889. %K A209859 nonn,base %O A209859 0,4 %A A209859 _Antti Karttunen_, Mar 24 2012