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 A027874 #17 Jul 02 2025 16:01:55 %S A027874 0,4,9,16,23,30,38,46,54,64,74,84,94,104,114,124,134,144,155,166,177, %T A027874 188,199,210,221,232,243,256,269,282,295,308,321,334,347,360,373,386, %U A027874 399,412,425,438,451,464,477,490,503,516,529,542,555,568,581,594,608 %N A027874 Minimal degree path length of a tree with n leaves. %D A027874 Theorem 5.4.9L in D. E. Knuth, `The Art of Computer Programming', Volume 3. %H A027874 Alois P. Heinz, <a href="/A027874/b027874.txt">Table of n, a(n) for n = 1..10000</a> %H A027874 <a href="/index/Tra#trees">Index entries for sequences related to trees</a> %F A027874 a(n) = 3*q*n+2*(n-3^q), if 2*3^(q-1)<=n<=3^q; 3*q*n+4*(n-3^q), if 3^q<=n<=2*3^q. %p A027874 a:= n-> (q-> `if`(n>2*3^q, 3*(q+1)*n+2*(n-3^(q+1)), %p A027874 3*q*n+4*(n-3^q)))(ilog[3](n)): %p A027874 seq(a(n), n=1..60); # _Alois P. Heinz_, Feb 22 2018 %t A027874 a[n_] := For[q = 0, True, q++, If[2*3^(q-1) <= n <= 3^q, Return[3*q*n + 2*(n-3^q)], If[3^q <= n <= 2*3^q, Return[3*q*n + 4*(n-3^q)]]]]; Array[a, 55] (* _Jean-François Alcover_, Oct 26 2015 *) %Y A027874 Cf. A003314. %K A027874 nonn,easy,nice %O A027874 1,2 %A A027874 _Don Knuth_ %E A027874 More terms from _James Sellers_