cp's OEIS Frontend

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.

Showing 1-4 of 4 results.

A347539 Matula-Goebel number of the n-th tree in Beyer and Hedetniemi's rooted tree iteration (A346913).

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 6, 8, 11, 17, 13, 10, 19, 14, 9, 12, 16, 31, 59, 41, 29, 22, 67, 43, 34, 23, 37, 26, 15, 20, 53, 38, 21, 28, 18, 24, 32, 127, 277, 179, 109, 79, 62, 331, 191, 139, 118, 83, 157, 101, 82, 47, 71, 58, 33, 44, 241, 163, 134, 73, 107, 86, 51, 68
Offset: 1

Views

Author

Kevin Ryde, Sep 06 2021

Keywords

Comments

This sequence is a permutation of the natural numbers, with inverse A347540.

Examples

			For n=33, row 33 of A346913 is levels sequence 1,2,3,3,2,3 which is the following tree,
  root      21          a(33) = 21 Matula-Goebel number
            |  \        (being prime(4)*prime(2) = 21)
  children  4    2
            |\   |
            1 1  1
		

Crossrefs

Cf. A346913, A347540 (inverse), A061773, A127301.

A347540 Position within Beyer and Hedetniemi's rooted tree iteration (A346913) of the tree with Matula-Goebel number n.

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 6, 8, 15, 12, 9, 16, 11, 14, 29, 17, 10, 35, 13, 30, 33, 22, 26, 36, 71, 28, 82, 34, 21, 73, 18, 37, 55, 25, 72, 83, 27, 32, 69, 74, 20, 80, 24, 56, 183, 66, 52, 84, 79, 180, 63, 70, 31, 197, 144, 81, 77, 54, 19, 184, 65, 43, 194, 85, 176, 146
Offset: 1

Views

Author

Kevin Ryde, Sep 06 2021

Keywords

Comments

This sequence is a permutation of the natural numbers, with inverse A347539.

Examples

			For n=21, the tree with Matula-Goebel number 21 is as follows, shown with siblings ordered per Beyer and Hedetniemi's canonical form,
  root      1           pre-order levels = 1,2,3,3,2,3
            |  \        which is row 33 of A346913
  level=2   2    2      so a(21) = 33
            |\   |
  level=3   3 3  3
		

Crossrefs

Cf. A346913, A347539 (inverse).

A346914 Irregular triangle read by rows where each row is the vertex parent array of a rooted forest in Knuth's form of Beyer and Hedetniemi's iteration.

Original entry on oeis.org

0, 0, 1, 0, 0, 0, 1, 2, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 2, 3, 0, 1, 2, 2, 0, 1, 2, 1, 0, 1, 2, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 1, 2, 3, 3, 0, 1, 2, 3, 2, 0, 1, 2, 3, 1, 0, 1, 2, 3, 0, 0, 1, 2, 2, 2, 0, 1, 2, 2, 1
Offset: 2

Views

Author

Kevin Ryde, Aug 07 2021

Keywords

Comments

Knuth's algorithm O adapts Beyer and Hedetniemi's rooted tree iteration (A346913) to rooted forests in vertex parent array form.
In a vertex parent array (vpar), with vertices numbered 1..N, vpar[v] is the parent of v, or if v has no parent (so a root) then vpar[v] = 0.
Forests are indexed here starting from n=2 so that forest n corresponds to tree n in A346913 (by removing the root from the tree). An empty row n=1 could be reckoned here corresponding to the singleton row n=1 in A346913.
Rows of N vertices are in lexicographically decreasing order, the same as the level sequences of A346913 are in lexicographically decreasing order.
The first row of N vertices is the path 0,1,2,...,N-1 and the last row of N vertices is the forest of N singletons 0,0,...,0,0.

Examples

			Triangle begins:
        v=1 v=2 v=3 v=4
  n=2:   0
  n=3:   0,  1
  n=4:   0,  0
  n=5:   0,  1,  2
  n=6:   0,  1,  1
  n=7:   0,  1,  0
  n=8:   0,  0,  0
  n=9:   0,  1,  2,  3
  n=10:  0,  1,  2,  2
Row n=1156 is 0,1,2,1,0,5,5,0,8 which is forest:
    roots   1    5    8     vertex 1 2 3 4 5 6 7 8 9
            |\   |\   |     vpar   0,1,2,1,0,5,5,0,8
  children  2 4  6 7  9
            |
            3
		

Crossrefs

Cf. A346913 (level sequences), A346915 (mems per forest), A373072 (row sums).

Programs

  • Mathematica
    (* Uses Algorithm O from Knuth's TAOCP section 7.2.1.6 *)
    olist[m_] := Block[{p = Range[m] - 1, j, d, k},
        Reap[
        While[True,
            Sow[p];
            If[p[[m]] > 0,
                p[[m]] = p[[p[[m]]]],
                k = m; While[k > 0 && p[[--k]] == 0];
                If[k == 0, Break[]];
                j = p[[k]]; d = k-- -j;
                While[++k <= m, p[[k]] = If[p[[k-d]] == p[[j]], p[[j]], p[[k-d]] + d]]
        ]]][[2, 1]]];
    Map[Delete[#, 0] &, Array[olist, 5]] (* Paolo Xausa, Apr 05 2024 *)
  • PARI
    \\ See links.

A346915 Decimal expansion of the limit as N->oo of the mean number of mems per forest taken by Knuth's algorithm O when generating the rooted forests of N vertices.

Original entry on oeis.org

3, 5, 3, 3, 9, 2, 6, 3, 9, 8, 0, 2, 3, 7, 2, 1, 7, 9, 6, 9, 1, 5, 9, 9, 9, 7, 5, 6, 9, 0, 0, 2, 7, 2, 7, 8, 4, 5, 1, 0, 8, 6, 7, 6, 0, 3, 2, 5, 7, 3, 7, 7, 2, 9, 1, 8, 0, 6, 7, 3, 4, 5, 8, 9, 4, 6, 0, 3, 4, 1, 2, 0, 6, 2, 1, 8, 6, 9, 2, 4, 9, 4, 1, 9, 7, 5, 0, 7, 7, 2, 5, 1, 2, 6, 3, 1, 2, 7, 2, 8, 7, 3, 0, 5, 5
Offset: 1

Views

Author

Kevin Ryde, Aug 07 2021

Keywords

Comments

Knuth volume 4A section 7.2.1.6 algorithm O adapts the rooted tree iteration algorithm of Beyer and Hedetniemi (A346913) to become a forests iteration in vertex parent array form (A346914).
Knuth's exercise 88 is to count mems (memory reads + memory writes) in algorithm O. Per Knuth's answer, the present constant is 2 + 3/(d-1) where d=A051491 is the growth power of rooted trees (and forests).
Also equals 3*S+2 where S=A346916 is the (limit) mean number of singletons in a rooted forest. The mems are S reads to find the end-most vertex k which is not a singleton, then S+1 reads and S+1 writes to change k and the singletons to subtree copies. Finding k examines S+1 array entries, but the algorithm holds the final p[N] in a register as well as in memory so no mem to examine it.

Examples

			3.533926398023721796915999756900272...
		

Crossrefs

Cf. A051491 (rooted tree growth), A346916 (mean singletons per forest).
Cf. A346913 (levels iteration), A346914 (vpar iteration).

Formula

Equals 2 + 3/(A051491 - 1). [Knuth]
Equals 3*A346916 + 2.
Showing 1-4 of 4 results.