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-10 of 27 results. Next

A109082 Depth of rooted tree having Matula-Goebel number n.

Original entry on oeis.org

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

Views

Author

Keith Briggs, Aug 17 2005

Keywords

Comments

Another term for depth is height.
Starting with n, a(n) is the number of times one must take the product of prime indices (A003963) to reach 1. - Gus Wiseman, Mar 27 2019

Examples

			a(7) = 2 because the rooted tree with Matula-Goebel number 7 is the 3-edge rooted tree Y of height 2.
		

Crossrefs

A left inverse of A007097.
Cf. A000081, A000720, A001222, A109129, A112798, A196050, A290822, A317713, A320325, A324927 (positions of 2), A324928 (positions of 3), A325032.
This statistic is counted by A034781, ordered A080936.
The ordered version is A358379.
For node-height instead of edge-height we have A358552.

Programs

  • Maple
    with(numtheory): a := proc(n) option remember; if n = 1 then 0 elif isprime(n) then 1+a(pi(n)) else max((map (p->a(p), factorset(n)))[]) end if end proc: seq(a(n), n = 1 .. 100); # Emeric Deutsch, Sep 16 2011
  • Mathematica
    a [n_] := a[n] = If[n == 1, 0, If[PrimeQ[n], 1+a[PrimePi[n]], Max[Map[a, FactorInteger[n][[All, 1]]]]]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, May 06 2014, after Emeric Deutsch *)
  • PARI
    a(n) = my(v=factor(n)[,1],d=0); while(#v,d++; v=fold(setunion, apply(p->factor(primepi(p))[,1]~, v))); d; \\ Kevin Ryde, Sep 21 2020
    
  • Python
    from functools import lru_cache
    from sympy import isprime, primepi, primefactors
    @lru_cache(maxsize=None)
    def A109082(n):
        if n == 1 : return 0
        if isprime(n): return 1+A109082(primepi(n))
        return max(A109082(p) for p in primefactors(n)) # Chai Wah Wu, Mar 19 2022

Formula

a(1)=0; if n is the t-th prime, then a(n) = 1 + a(t); if n is composite, n=t*s, then a(n) = max(a(t),a(s)). The Maple program is based on this.
a(A007097(n)) = n.
a(n) = A358552(n) - 1. - Gus Wiseman, Nov 27 2022

Extensions

Edited by Emeric Deutsch, Sep 16 2011

A358577 Matula-Goebel numbers of "square" rooted trees, i.e., whose height equals their number of leaves.

Original entry on oeis.org

1, 4, 12, 14, 18, 19, 21, 27, 40, 52, 60, 68, 70, 74, 78, 86, 89, 90, 91, 92, 95, 100, 102, 105, 107, 111, 117, 119, 122, 129, 130, 134, 135, 138, 146, 150, 151, 153, 161, 163, 169, 170, 175, 176, 181, 183, 185, 195, 201, 206, 207, 215, 219, 221, 225, 227, 230
Offset: 1

Views

Author

Gus Wiseman, Nov 25 2022

Keywords

Comments

The Matula-Goebel number of a rooted tree is the product of primes indexed by the Matula-Goebel numbers of the branches of its root, which gives a bijective correspondence between positive integers and unlabeled rooted trees.

Examples

			The terms together with their corresponding rooted trees begin:
   1: o
   4: (oo)
  12: (oo(o))
  14: (o(oo))
  18: (o(o)(o))
  19: ((ooo))
  21: ((o)(oo))
  27: ((o)(o)(o))
  40: (ooo((o)))
  52: (oo(o(o)))
  60: (oo(o)((o)))
  68: (oo((oo)))
  70: (o((o))(oo))
  74: (o(oo(o)))
  78: (o(o)(o(o)))
  86: (o(o(oo)))
  89: ((ooo(o)))
  90: (o(o)(o)((o)))
		

Crossrefs

Internals instead of leaves: A358576, counted by A358587, ordered A358588.
Internals instead of height: A358578, counted by A185650, ordered A358579.
These trees are counted by A358589, ordered A358590.
A000081 counts rooted trees, ordered A000108.
A034781 counts trees by nodes and height.
A055277 counts trees by nodes and leaves, ordered A001263.

Programs

  • Mathematica
    MGTree[n_]:=If[n==1,{},MGTree/@Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
    Select[Range[100],Count[MGTree[#],{},{0,Infinity}]==Depth[MGTree[#]]-1&]

Formula

A358552(a(n)) = A109129(a(n)).

A358552 Node-height of the rooted tree with Matula-Goebel number n. Number of nodes in the longest path from root to leaf.

Original entry on oeis.org

1, 2, 3, 2, 4, 3, 3, 2, 3, 4, 5, 3, 4, 3, 4, 2, 4, 3, 3, 4, 3, 5, 4, 3, 4, 4, 3, 3, 5, 4, 6, 2, 5, 4, 4, 3, 4, 3, 4, 4, 5, 3, 4, 5, 4, 4, 5, 3, 3, 4, 4, 4, 3, 3, 5, 3, 3, 5, 5, 4, 4, 6, 3, 2, 4, 5, 4, 4, 4, 4, 5, 3, 4, 4, 4, 3, 5, 4, 6, 4, 3, 5, 5, 3, 4, 4, 5, 5, 4, 4, 4, 4, 6, 5, 4, 3, 5, 3, 5, 4, 5, 4, 4, 4, 4, 3, 4, 3
Offset: 1

Views

Author

Gus Wiseman, Nov 26 2022

Keywords

Comments

Edge-height is given by A109082 (see formula).
The Matula-Goebel number of a rooted tree is the product of primes indexed by the Matula-Goebel numbers of the branches of its root, which gives a bijective correspondence between positive integers and unlabeled rooted trees.

Examples

			The Matula-Goebel number of ((ooo(o))) is 89, and it has node-height 4, so a(89) = 4.
		

Crossrefs

Positions of first appearances are A007097.
This statistic is counted by A034781, ordered A080936.
The ordered version is A358379(n) + 1.
A000081 counts rooted trees, ordered A000108.
A055277 counts rooted trees by nodes and leaves, ordered A001263.
Other statistics: A061775 (nodes), A109082 (edge-height), A109129 (leaves), A196050 (edges), A342507 (internals).

Programs

  • Mathematica
    MGTree[n_]:=If[n==1,{},MGTree/@If[n==1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]]];
    Table[Depth[MGTree[n]]-1,{n,100}]
  • PARI
    A358552(n) = { my(v=factor(n)[, 1], d=0); while(#v, d++; v=fold(setunion, apply(p->factor(primepi(p))[, 1]~, v))); (1+d); }; \\ (after Kevin Ryde in A109082) - Antti Karttunen, Oct 23 2023
    
  • Python
    from functools import lru_cache
    from sympy import isprime, primepi, primefactors
    @lru_cache(maxsize=None)
    def A358552(n):
        if n == 1 : return 1
        if isprime(n): return 1+A358552(primepi(n))
        return max(A358552(p) for p in primefactors(n)) # Chai Wah Wu, Apr 15 2024

Formula

a(n) = A109082(n) + 1.
a(n) = A061775(n) - A358729(n). - Antti Karttunen, Oct 23 2023

Extensions

Data section extended up to a(108) by Antti Karttunen, Oct 23 2023

A358578 Matula-Goebel numbers of rooted trees whose number of leaves equals their number of internal (non-leaf) nodes.

Original entry on oeis.org

2, 6, 7, 18, 20, 21, 26, 34, 37, 43, 54, 60, 63, 67, 70, 78, 88, 91, 92, 95, 102, 111, 116, 119, 122, 129, 142, 146, 151, 162, 164, 173, 180, 181, 189, 200, 201, 202, 210, 227, 234, 236, 239, 245, 260, 264, 269, 273, 276, 278, 285, 306, 308, 314, 322, 333, 337
Offset: 1

Views

Author

Gus Wiseman, Nov 25 2022

Keywords

Comments

The Matula-Goebel number of a rooted tree is the product of primes indexed by the Matula-Goebel numbers of the branches of its root, which gives a bijective correspondence between positive integers and unlabeled rooted trees.

Examples

			The terms together with their corresponding rooted trees begin:
   2: (o)
   6: (o(o))
   7: ((oo))
  18: (o(o)(o))
  20: (oo((o)))
  21: ((o)(oo))
  26: (o(o(o)))
  34: (o((oo)))
  37: ((oo(o)))
  43: ((o(oo)))
  54: (o(o)(o)(o))
  60: (oo(o)((o)))
  63: ((o)(o)(oo))
  67: (((ooo)))
  70: (o((o))(oo))
  78: (o(o)(o(o)))
  88: (ooo(((o))))
  91: ((oo)(o(o)))
		

Crossrefs

These trees are counted by A185650, ordered A358579.
Height instead of leaves: A358576, counted by A358587, ordered A358588.
Height instead of internals: A358577, counted by A358589, ordered A358590.
Positions of 0's in A358580.
A000081 counts rooted trees, ordered A000108.
A034781 counts trees by nodes and height.
A055277 counts trees by nodes and leaves, ordered A001263.

Programs

  • Mathematica
    MGTree[n_]:=If[n==1,{},MGTree/@Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
    Select[Range[100],Count[MGTree[#],{},{0,Infinity}]==Count[MGTree[#],[_],{0,Infinity}]&]

Formula

A342507(a(n)) = A109129(a(n)).

A358576 Matula-Goebel numbers of rooted trees whose node-height equals their number of internal (non-leaf) nodes.

Original entry on oeis.org

9, 15, 18, 21, 23, 30, 33, 35, 36, 39, 42, 46, 47, 49, 51, 57, 60, 61, 66, 70, 72, 73, 77, 78, 83, 84, 87, 91, 92, 93, 94, 95, 98, 102, 111, 113, 114, 119, 120, 122, 123, 129, 132, 133, 137, 140, 144, 146, 149, 151, 154, 156, 159, 166, 167, 168, 174, 177, 181
Offset: 1

Views

Author

Gus Wiseman, Nov 25 2022

Keywords

Comments

The Matula-Goebel number of a rooted tree is the product of primes indexed by the Matula-Goebel numbers of the branches of its root, which gives a bijective correspondence between positive integers and unlabeled rooted trees.
Node-height is the number of nodes in the longest path from root to leaf.

Examples

			The terms together with their corresponding rooted trees begin:
   9: ((o)(o))
  15: ((o)((o)))
  18: (o(o)(o))
  21: ((o)(oo))
  23: (((o)(o)))
  30: (o(o)((o)))
  33: ((o)(((o))))
  35: (((o))(oo))
  36: (oo(o)(o))
  39: ((o)(o(o)))
  42: (o(o)(oo))
  46: (o((o)(o)))
  47: (((o)((o))))
  49: ((oo)(oo))
  51: ((o)((oo)))
  57: ((o)(ooo))
  60: (oo(o)((o)))
  61: ((o(o)(o)))
		

Crossrefs

The version for edge-height is A209638.
Square trees are A358577, counted by A358589, ordered A358590.
The version for leaves instead of height is A358578, counted by A185650.
These trees are counted by A358587, ordered A358588.
A000081 counts rooted trees, ordered A000108.
A034781 counts rooted trees by nodes and height.
A055277 counts rooted trees by leaves, ordered A001263.

Programs

  • Mathematica
    MGTree[n_]:=If[n==1,{},MGTree/@Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
    Select[Range[100],Count[MGTree[#],[_],{0,Infinity}]==Depth[MGTree[#]]-1&]

Formula

A358552(a(n)) = A342507(a(n)).

A358580 Difference between the number of leaves and the number of internal (non-leaf) nodes in the rooted tree with Matula-Goebel number n.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Nov 25 2022

Keywords

Comments

The Matula-Goebel number of a rooted tree is the product of primes indexed by the Matula-Goebel numbers of the branches of its root, which gives a bijective correspondence between positive integers and unlabeled rooted trees.

Examples

			The Matula-Goebel number of ((ooo(o))) is 89, and it has 4 leaves and 3 internal nodes, so a(89) = 1.
		

Crossrefs

Zeros are A358578, counted by A185650 (ordered A358579).
Positions of positive terms are counted by A358581, negative A358582.
Positions of nonnegative terms are counted by A358583, nonpositive A358584.
A000081 counts rooted trees, ordered A000108.
A034781 counts trees by nodes and height.
A055277 counts trees by nodes and leaves, ordered A001263.

Programs

  • Mathematica
    MGTree[n_]:=If[n==1,{},MGTree/@Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
    Table[Count[MGTree[n],{},{0,Infinity}]-Count[MGTree[n],[_],{0,Infinity}],{n,100}]

Formula

a(n) = A109129(n) - A342507(n).

A358586 Number of ordered rooted trees with n nodes, at least half of which are leaves.

Original entry on oeis.org

1, 1, 1, 4, 7, 31, 66, 302, 715, 3313, 8398, 39095, 104006, 484706, 1337220, 6227730, 17678835, 82204045, 238819350, 1108202513, 3282060210, 15195242478, 45741281820, 211271435479, 644952073662, 2971835602526, 9183676536076, 42217430993002, 131873975875180, 604834233372884
Offset: 1

Views

Author

Gus Wiseman, Nov 24 2022

Keywords

Examples

			The a(1) = 1 through a(5) = 7 ordered trees:
  o  (o)  (oo)  (ooo)   (oooo)
                ((o)o)  ((o)oo)
                ((oo))  ((oo)o)
                (o(o))  ((ooo))
                        (o(o)o)
                        (o(oo))
                        (oo(o))
		

Crossrefs

For equality we have A000891, unordered A185650.
Odd-indexed terms appear to be A065097.
The unordered version is A358583.
The opposite is the same, unordered A358584.
The strict case is A358585, unordered A358581.
A000108 counts ordered rooted trees, unordered A000081.
A001263 counts ordered rooted trees by nodes and leaves, unordered A055277.
A080936 counts ordered rooted trees by nodes and height, unordered A034781.
A090181 counts ordered rooted trees by nodes and internals, unord. A358575.
A358590 counts square ordered trees, unordered A358589 (ranked by A358577).

Programs

  • Mathematica
    aot[n_]:=If[n==1,{{}},Join@@Table[Tuples[aot/@c],{c,Join@@Permutations/@IntegerPartitions[n-1]}]];
    Table[Length[Select[aot[n],Count[#,{},{0,Infinity}]>=Count[#,[_],{0,Infinity}]&]],{n,1,10}]
  • PARI
    a(n) = if(n==1, 1, n--; (binomial(2*n,n)/(n+1) + if(n%2, binomial(n, (n-1)/2)^2 / n))/2) \\ Andrew Howroyd, Jan 13 2024

Formula

From Andrew Howroyd, Jan 13 2024: (Start)
a(n) = Sum_{k=1..floor(n/2)} A001263(n-1, k) for n >= 2.
a(2*n) = (A000108(2*n-1) + A000891(n-1))/2 for n >= 1;
a(2*n+1) = A000108(2*n)/2 for n >= 1. (End)

Extensions

a(16) onwards from Andrew Howroyd, Jan 13 2024

A358587 Number of n-node rooted trees of height equal to the number of internal (non-leaf) nodes.

Original entry on oeis.org

0, 0, 0, 0, 1, 4, 14, 41, 111, 282, 688, 1627, 3761, 8540, 19122, 42333, 92851, 202078, 436916, 939359, 2009781, 4281696, 9087670, 19223905, 40544951, 85284194, 178956984, 374691171, 782936761, 1632982372, 3400182458, 7068800357, 14674471611, 30422685030
Offset: 1

Views

Author

Gus Wiseman, Nov 23 2022

Keywords

Examples

			The a(5) = 1 through a(7) = 14 trees:
  ((o)(o))  ((o)(oo))   ((o)(ooo))
            (o(o)(o))   ((oo)(oo))
            (((o)(o)))  (o(o)(oo))
            ((o)((o)))  (oo(o)(o))
                        (((o))(oo))
                        (((o)(oo)))
                        ((o)((oo)))
                        ((o)(o(o)))
                        ((o(o)(o)))
                        (o((o)(o)))
                        (o(o)((o)))
                        ((((o)(o))))
                        (((o)((o))))
                        ((o)(((o))))
		

Crossrefs

For leaves instead of height we have A185650 aerated, ranked by A358578.
These trees are ranked by A358576.
The ordered version is A358588.
Square trees are counted by A358589, ranked by A358577, ordered A358590.
A000081 counts rooted trees, ordered A000108.
A034781 counts rooted trees by nodes and height, ordered A080936.
A055277 counts rooted trees by nodes and leaves, ordered A001263.
A358575 counts rooted trees by nodes and internal nodes, ordered A090181.

Programs

  • Mathematica
    art[n_]:=If[n==1,{{}},Join@@Table[Select[Tuples[art/@c],OrderedQ],{c,Join@@Permutations/@IntegerPartitions[n-1]}]];
    Table[Length[Select[art[n],Count[#,[_],{0,Infinity}]==Depth[#]-1&]],{n,1,10}]
  • PARI
    \\ Needs R(n,f) defined in A358589.
    seq(n) = {Vec(R(n, (h,p)->polcoef(subst(p, x, x/y), -h, y)), -n)} \\ Andrew Howroyd, Jan 01 2023

Formula

Conjectures from Chai Wah Wu, Apr 15 2024: (Start)
a(n) = 5*a(n-1) - 7*a(n-2) - a(n-3) + 8*a(n-4) - 4*a(n-5) for n > 7.
G.f.: x^5*(x^2 - x + 1)/((x - 1)^2*(x + 1)*(2*x - 1)^2). (End)

Extensions

Terms a(19) and beyond from Andrew Howroyd, Jan 01 2023

A358581 Number of rooted trees with n nodes, most of which are leaves.

Original entry on oeis.org

1, 0, 1, 1, 4, 5, 20, 28, 110, 169, 663, 1078, 4217, 7169, 27979, 49191, 191440, 345771, 1341974, 2477719, 9589567, 18034670, 69612556, 132984290, 511987473, 991391707, 3807503552, 7460270591, 28585315026, 56595367747, 216381073935, 432396092153
Offset: 1

Views

Author

Gus Wiseman, Nov 23 2022

Keywords

Examples

			The a(1) = 1 through a(7) = 20 trees:
  o  .  (oo)  (ooo)  (oooo)   (ooooo)   (oooooo)
                     ((ooo))  ((oooo))  ((ooooo))
                     (o(oo))  (o(ooo))  (o(oooo))
                     (oo(o))  (oo(oo))  (oo(ooo))
                              (ooo(o))  (ooo(oo))
                                        (oooo(o))
                                        (((oooo)))
                                        ((o)(ooo))
                                        ((o(ooo)))
                                        ((oo)(oo))
                                        ((oo(oo)))
                                        ((ooo(o)))
                                        (o((ooo)))
                                        (o(o)(oo))
                                        (o(o(oo)))
                                        (o(oo(o)))
                                        (oo((oo)))
                                        (oo(o)(o))
                                        (oo(o(o)))
                                        (ooo((o)))
		

Crossrefs

For equality we have A185650 aerated, ranked by A358578.
The opposite version is A358582, non-strict A358584.
The non-strict version is A358583.
The ordered version is A358585, odd-indexed terms A065097.
A000081 counts rooted trees, ordered A000108.
A034781 counts rooted trees by nodes and height, ordered A080936.
A055277 counts rooted trees by nodes and leaves, ordered A001263.
A358575 counts rooted trees by nodes and internal nodes, ordered A090181.
A358589 counts square trees, ranked by A358577, ordered A358590.

Programs

  • Mathematica
    art[n_]:=If[n==1,{{}},Join@@Table[Select[Tuples[art/@c],OrderedQ],{c,Join@@Permutations/@IntegerPartitions[n-1]}]];
    Table[Length[Select[art[n],Count[#,{},{0,Infinity}]>Count[#,[_],{0,Infinity}]&]],{n,0,10}]
  • PARI
    \\ See A358584 for R(n).
    seq(n) = {my(A=R(n)); vector(n, n, my(u=Vecrev(A[n]/y)); vecsum(u[n\2+1..#u]))} \\ Andrew Howroyd, Dec 31 2022

Formula

A358581(n) + A358584(n) = A000081(n).
A358582(n) + A358583(n) = A000081(n).
a(n) = Sum_{k=floor(n/2)+1..n} A055277(n, k). - Andrew Howroyd, Dec 31 2022

Extensions

Terms a(19) and beyond from Andrew Howroyd, Dec 31 2022

A358575 Triangle read by rows where T(n,k) is the number of unlabeled n-node rooted trees with k = 0..n-1 internal (non-leaf) nodes.

Original entry on oeis.org

1, 0, 1, 0, 1, 1, 0, 1, 2, 1, 0, 1, 3, 4, 1, 0, 1, 4, 8, 6, 1, 0, 1, 5, 14, 18, 9, 1, 0, 1, 6, 21, 39, 35, 12, 1, 0, 1, 7, 30, 72, 97, 62, 16, 1, 0, 1, 8, 40, 120, 214, 212, 103, 20, 1, 0, 1, 9, 52, 185, 416, 563, 429, 161, 25, 1
Offset: 1

Views

Author

Gus Wiseman, Nov 23 2022

Keywords

Examples

			Triangle begins:
    1
    0    1
    0    1    1
    0    1    2    1
    0    1    3    4    1
    0    1    4    8    6    1
    0    1    5   14   18    9    1
    0    1    6   21   39   35   12    1
    0    1    7   30   72   97   62   16    1
    0    1    8   40  120  214  212  103   20    1
    0    1    9   52  185  416  563  429  161   25    1
		

Crossrefs

Row sums are A000081.
Column k = n - 2 appears to be A002620.
Column k = 3 appears to be A006578.
The version for height instead of internal nodes is A034781.
Equals A055277 with rows reversed.
The ordered version is A090181 or A001263.
The central column is A185650, ordered A000891.
The left half sums to A358583, strict A358581.
The right half sums to A358584, strict A358582.

Programs

  • Mathematica
    art[n_]:=If[n==1,{{}},Join@@Table[Select[Tuples[art/@c],OrderedQ],{c,Join@@Permutations/@IntegerPartitions[n-1]}]];
    Table[Length[Select[art[n],Count[#,[_],{0,Infinity}]==k&]],{n,1,10},{k,0,n-1}]
Showing 1-10 of 27 results. Next