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 A217710 #39 Aug 14 2021 18:34:24 %S A217710 1,1,1,1,1,1,1,2,1,1,1,1,2,2,2,2,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2, %T A217710 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,2,2,2,2, %U A217710 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 %N A217710 Cardinality of the set of possible heights of AVL trees with n (leaf-) nodes. %C A217710 a(n) increases at Fibonacci numbers (A000045) and decreases at powers of 2 plus 1 (A000051) for n>=8. %C A217710 a(n) is the height (number of nonzero elements) of column n of triangles A143897, A217298. %H A217710 Alois P. Heinz, <a href="/A217710/b217710.txt">Table of n, a(n) for n = 1..50000</a> %H A217710 Wikipedia, <a href="https://en.wikipedia.org/wiki/AVL_tree">AVL tree</a> %H A217710 <a href="/index/Ro#rooted">Index entries for sequences related to rooted trees</a> %F A217710 a(n) = A072649(n) - A029837(n). %e A217710 a(8) = 2: We have 1 AVL tree with n=8 (leaf-) nodes of height 3 and 16 of height 4 (8 is both Fibonacci number and power of 2): %e A217710 o o %e A217710 / \ / \ %e A217710 o o o o %e A217710 / \ / ) / \ / \ %e A217710 o o o N o o o o %e A217710 / ) ( ) ( ) ( ) ( ) ( ) ( ) %e A217710 o N N N N N N N N N N N N N %e A217710 ( ) %e A217710 N N %p A217710 a:= proc(n) local j, p; for j from ilog[(1+sqrt(5))/2](n) %p A217710 while combinat[fibonacci](j+1)<=n do od; %p A217710 p:= ilog2(n); %p A217710 j-p-`if`(2^p<n, 2, 1) %p A217710 end: %p A217710 seq(a(n), n=1..120); %p A217710 # second Maple program: %p A217710 a:= proc(n) option remember; `if`(n=0, 1, a(n-1)+ %p A217710 `if`((t-> issqr(t+4) or issqr(t-4))(5*n^2), 1, 0)- %p A217710 `if`((t-> is(2^ilog2(t)=t))(n-1), 1, 0)) %p A217710 end: %p A217710 seq(a(n), n=1..120); # _Alois P. Heinz_, Aug 14 2021 %t A217710 a[n_] := Module[{j, p}, For[j = Log[(1+Sqrt[5])/2, n] // Floor, Fibonacci[j+1] <= n, j++]; p = Log[2, n] // Floor; j-p-If[2^p < n, 2, 1]]; Table[a[n], {n, 1, 120}] (* _Jean-François Alcover_, Dec 30 2013, translated from Maple *) %Y A217710 Cf. A000045, A000051, A000079, A029837, A072649, A143897, A217298. %K A217710 nonn %O A217710 1,8 %A A217710 _Alois P. Heinz_, Mar 20 2013