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 A354902 #95 Mar 22 2025 20:43:33 %S A354902 1,3,7,11,19,31,47,67,91,119,151,187,227,271,319,371,427,487,551,619, %T A354902 691,767,847,931,1019,1111,1207,1307,1411,1519,1631,1747,1867,1991, %U A354902 2119,2251,2387,2527,2671,2819,2971,3127,3287,3451,3619,3791,3967,4147,4331,4519,4711,4907 %N A354902 a(n) = 2*n^2 - 6*n + 11 for n > 1 with a(0)=1 and a(1)=3. %C A354902 a(n) is the minimum number of nodes required for a full binary tree where each node in all longest paths from the root node down to any leaf node is height-balanced and the root node has a height balance factor of 0. %C A354902 Full binary tree: A binary tree is called a full binary tree if each node has exactly two children or no children. %H A354902 Michael De Vlieger, <a href="/A354902/b354902.txt">Table of n, a(n) for n = 0..10000</a> %H A354902 Lecture Notes for Computer Science 2530, <a href="https://web.archive.org/web/20240419184618/https://cs.ecu.edu/karl/2530/spr18/Notes/lec37+38.html">Height-balanced trees</a> %H A354902 NIST, <a href="https://xlinux.nist.gov/dads/HTML/root.html">Root node</a> %H A354902 NIST, <a href="https://xlinux.nist.gov/dads/HTML/leaf.html">Leaf node</a> %H A354902 Wikipedia, <a href="https://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees">Full binary tree</a> %H A354902 <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (3,-3,1). %F A354902 a(n) = 2*A027688(n-2) + 1, for n >= 2. %F A354902 a(n) = 4*A022856(n+2) - 1, for n >= 1. %F A354902 a(n) = a(n-1) + 4*(n-2) for n >= 3. %F A354902 G.f.: (1 + x^2 - 2*x^3 + 4*x^4)/(1 - x)^3. - _Stefano Spezia_, Jun 12 2022 %F A354902 Sum_{n>=2} 1/a(n) = Pi*tanh(sqrt(13)*Pi/2)/(2*sqrt(13)). - _Amiram Eldar_, Jul 10 2022 %e A354902 The diagrams below illustrate the terms a(3)=11 and a(4)=19. %e A354902 R R %e A354902 / \ / \ %e A354902 / \ / \ %e A354902 / \ / \ %e A354902 o o / \ %e A354902 / \ / \ / \ %e A354902 o N N o / \ %e A354902 / \ / \ / \ %e A354902 N N N N o o %e A354902 / \ / \ %e A354902 / \ / \ %e A354902 / \ / \ %e A354902 o o o o %e A354902 / \ / \ / \ / \ %e A354902 o N N N N N o N %e A354902 / \ / \ %e A354902 N N N N %t A354902 CoefficientList[Series[(1 + x^2 - 2 x^3 + 4 x^4)/(1 - x)^3, {x, 0, 51}], x] (* _Michael De Vlieger_, Jun 19 2022 *) %o A354902 (C) int a(int n){ return n>1 ? 2*(n*n) - 6*n + 11 : 2*n + 1; } %Y A354902 Cf. A022856, A027688. %K A354902 nonn,easy %O A354902 0,2 %A A354902 _Sumukh Patel_, Jun 11 2022