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 A085184 #10 Jan 12 2024 10:25:55 %S A085184 0,1,2,11,12,21,22,30,111,112,121,122,130,211,212,221,222,230,301,302, %T A085184 310,320,1111,1112,1121,1122,1130,1211,1212,1221,1222,1230,1301,1302, %U A085184 1310,1320,2111,2112,2121,2122,2130,2211,2212,2221,2222,2230,2301,2302 %N A085184 Sequence A085183 shown in base 4. Quaternary code for binary trees. %C A085184 This sequence gives two alternative ways to encode rooted plane binary trees (Stanley's interpretation 'c' = interpretation 'd' without the outermost edges): %C A085184 A: scan each term from left to right and for each 0, add a leaf node to the tree (terminate a branch), for each 1, add a leftward leaning branch \, for each 2, add a rightward leaning branch / and for each 3, add a double-branch \/ and continue in left-to-right, depth-first fashion. %C A085184 B: Like method A, but the roles of digits 1 and 2 are swapped. When one compares the generated trees to the "standard order" as specified in the illustrations for A014486, one obtains the permutation A074684/A074683 for the case A and A082356/A082355 for the case B. %C A085184 If we assign the following weights for each digit: w(0) = -1, w(1) = w(2) = 0, w(3) = +1, then the sequence gives all base-4 numbers for which all the partial sums of digit weights (from the most significant to the least significant end) are nonnegative and the final sum is zero. The initial term 0 is considered to have no significant digits at all, so its total weight is zero also. %H A085184 R. P. Stanley, <a href="http://www-math.mit.edu/~rstan/ec/catalan.pdf">Exercises on Catalan and Related Numbers</a> %F A085184 a(n) = A007090(A085183(n)). %e A085184 For the first eleven terms the following binary trees are constructed with method A. With method B we would get their mirror images, although this doesn't hold in general (e.g. for terms like 301-320). %e A085184 ........................................................\......./......\... %e A085184 .....................\......./.......\......./...........\......\....../... %e A085184 ..*......\....../.....\......\......./....../.....\/......\......\.....\... %e A085184 ..0......1......2.....11.....12.....21.....22.....30....111....112....121.. %Y A085184 Cf. A085185. Number of terms with n significant digits is given by A000108(n+1). %K A085184 nonn,base %O A085184 1,3 %A A085184 _Antti Karttunen_, Jun 14 2003