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 A131889 #18 Aug 01 2019 18:24:35 %S A131889 1,1,3,3,1,9,27,27,81,81,27,27,9,1,27,243,729,6561,19683,19683,59049, %T A131889 59049,19683,177147,531441,531441,1594323,1594323,531441,531441, %U A131889 177147,19683,59049,59049,19683,19683,6561,729,243,27,1,81,2187,19683,531441,4782969 %N A131889 a(n) is the number of shapes of balanced trees with constant branching factor 3 and n nodes. The node is balanced if the size, measured in nodes, of each pair of its children differ by at most one node. %C A131889 a(n) is always an integer power of 3. %H A131889 Alois P. Heinz, <a href="/A131889/b131889.txt">Table of n, a(n) for n = 0..1093</a> %H A131889 Jeffrey Barnett, <a href="http://notatt.com/btree-shapes.pdf">Counting Balanced Tree Shapes</a>. %F A131889 a(0) = a(1) = 1; a(3n+1+m) = (3 choose m) * a(n+1)^m * a(n)^(3-m), where n >= 0 and 0 <= m <= 3. %p A131889 a:= proc(n) option remember; local m, r; if n<2 then 1 else %p A131889 r:= iquo(n-1, 3, 'm'); binomial(3, m) *a(r+1)^m *a(r)^(3-m) fi %p A131889 end: %p A131889 seq(a(n), n=0..50); # _Alois P. Heinz_, Apr 10 2013 %t A131889 a[n_, k_] := a[n, k] = Module[{m, r}, If[n < 2 || k == 1, 1, If[k == 0, 0, {r, m} = QuotientRemainder[n - 1, k]; Binomial[k, m]*a[r + 1, k]^m*a[r, k]^(k - m)]]]; %t A131889 a[n_] := a[n, 3]; %t A131889 Table[a[n], {n, 0, 50}] (* _Jean-François Alcover_, Jun 04 2018, after _Alois P. Heinz_ *) %Y A131889 Cf. A110316, A131890, A131891, A131892, A131893. %Y A131889 Column k=3 of A221857. - _Alois P. Heinz_, Apr 17 2013 %K A131889 easy,nonn,look %O A131889 0,3 %A A131889 _Jeffrey Barnett_, Jul 24 2007