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-5 of 5 results.

A196047 Path length of the rooted tree with Matula-Goebel number n.

Original entry on oeis.org

0, 1, 3, 2, 6, 4, 5, 3, 6, 7, 10, 5, 8, 6, 9, 4, 9, 7, 7, 8, 8, 11, 11, 6, 12, 9, 9, 7, 12, 10, 15, 5, 13, 10, 11, 8, 10, 8, 11, 9, 13, 9, 11, 12, 12, 12, 15, 7, 10, 13, 12, 10, 9, 10, 16, 8, 10, 13, 14, 11, 13, 16, 11, 6, 14, 14, 12, 11, 14, 12, 14, 9, 14, 11, 15, 9, 15, 12, 17, 10, 12, 14, 17, 10, 15, 12, 15, 13, 12, 13, 13, 13, 18, 16, 13, 8, 19, 11, 16, 14
Offset: 1

Views

Author

Emeric Deutsch, Sep 27 2011

Keywords

Comments

The path length of a rooted tree is defined as the sum of distances of all nodes to the root of the tree.
The Matula-Goebel number of a rooted tree is defined in the following recursive manner: to the one-vertex tree there corresponds the number 1; to a tree T with root degree 1 there corresponds the t-th prime number, where t is the Matula-Goebel number of the tree obtained from T by deleting the edge emanating from the root; to a tree T with root degree m>=2 there corresponds the product of the Matula-Goebel numbers of the m branches of T.

Examples

			a(7) = 5 because the rooted tree with Matula-Goebel number 7 is the rooted tree Y (0+1+2+2 = 5).
a(2^m) = m because the rooted tree with Matula-Goebel number 2^m is a star with m edges.
		

Crossrefs

Programs

  • Haskell
    import Data.List (genericIndex)
    a196047 n = genericIndex a196047_list (n - 1)
    a196047_list = 0 : g 2 where
       g x = y : g (x + 1) where
         y = if t > 0 then a196047 t + a061775 t else a196047 r + a196047 s
             where t = a049084 x; r = a020639 x; s = x `div` r
    -- Reinhard Zumkeller, Sep 03 2013
    
  • Maple
    with(numtheory): a := proc (n) local r, s, N: r := proc (n) options operator, arrow: op(1, factorset(n)) end proc: s := proc (n) options operator, arrow: n/r(n) end proc: N := proc (n) if n = 1 then 1 elif bigomega(n) = 1 then 1+N(pi(n)) else N(r(n))+N(s(n))-1 end if end proc: if n = 1 then 0 elif bigomega(n) = 1 then a(pi(n))+N(pi(n)) else a(r(n))+a(s(n)) end if end proc: seq(a(n), n = 1 .. 100);
  • Mathematica
    a[m_] := Module[{r, s, Nn},
       r[n_] := FactorInteger[n][[1, 1]];
       s[n_] := n/r[n];
       Nn[n_] := Which[n == 1, 1,
          PrimeOmega[n] == 1, 1+Nn[PrimePi[n]],
          True, Nn[r[n]]+Nn[s[n]]-1];
       Which[m == 1, 0,
       PrimeOmega[m] == 1, a[PrimePi[m]]+Nn[PrimePi[m]],
       True, a[r[m]]+a[s[m]]]];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, May 03 2023, after Maple code *)
  • PARI
    NPl(n) = { if(n==1, return([1,0]),
        my(f=factor(n)~, v=Mat(vector(#f,k,NPl(primepi(f[1,k]))~))  );
        return( [ 1+sum(k=1,#f,v[1,k]*f[2,k]) , sum(k=1,#f,(v[1,k]+v[2,k])*f[2,k]) ] ) )
      };
    A196047(n) = NPl(n)[2]; \\ François Marques, Apr 02 2021

Formula

a(1)=0; if n=prime(t) then a(n)=a(t)+N(t), where N(t) is the number of nodes of the rooted tree with Matula number t; if n=r*s (r,s>=2), then a(n)=a(r)+a(s). The Maple program is based on this recursive formula.
a(n) = A196048(n) + A343006(n). - François Marques, Apr 02 2021

A348959 Childless terminal Wiener index of the rooted tree with Matula-Goebel number n.

Original entry on oeis.org

0, 0, 0, 2, 0, 3, 2, 6, 4, 4, 0, 8, 3, 8, 5, 12, 2, 10, 6, 10, 10, 5, 4, 15, 6, 10, 12, 16, 4, 12, 0, 20, 6, 10, 12, 18, 8, 15, 12, 18, 3, 19, 8, 12, 14, 12, 5, 24, 20, 14, 12, 19, 12, 21, 7, 26, 18, 12, 2, 21, 10, 6, 22, 30, 14, 14, 6, 20, 14, 22, 10, 28, 10
Offset: 1

Views

Author

Kevin Ryde, Nov 05 2021

Keywords

Comments

This is a variation on the terminal Wiener index defined by Gutman, Furtula, and Petrović. Here terminal vertices are taken as the childless vertices, so a(n) is the sum of the path lengths between pairs of childless vertices.
This sequence differs from the free tree form A196055 when n is prime, since n prime means the root is degree 1 so is a terminal vertex for A196055 but not here.

Crossrefs

Cf. A196055 (free tree), A196048 (external path length), A109129 (childless vertices), A288469 (unplant).
Cf. A027746 (prime factorization).

Programs

  • PARI
    \\ See links.

Formula

a(n) = Sum_{j=1..k} (a(primepi(p[j])) + E(p[j])*(C(n)-C(p[j]))), where n = p[1]*...*p[k] is the prime factorization of n with multiplicity (A027746), E(n) = A196048(n) is external path length, and C(n) = A109129(n) is number of childless vertices.
a(n) = A196055(n) - (A196048(n) if n prime).
a(n) = A196055(A288469(n)).

A196055 The terminal Wiener index of the rooted tree with Matula-Goebel number n.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 6, 6, 4, 4, 4, 8, 8, 8, 5, 12, 8, 10, 12, 10, 10, 5, 10, 15, 6, 10, 12, 16, 10, 12, 5, 20, 6, 10, 12, 18, 15, 15, 12, 18, 10, 19, 16, 12, 14, 12, 12, 24, 20, 14, 12, 19, 20, 21, 7, 26, 18, 12, 10, 21, 18, 6, 22, 30, 14, 14, 15, 20, 14, 22, 18, 28, 19, 18, 16, 26, 14, 22, 12, 28, 24, 12, 12, 30, 14, 19, 14, 21, 24, 24
Offset: 1

Views

Author

Emeric Deutsch, Sep 29 2011

Keywords

Comments

The terminal Wiener index of a connected graph is the sum of the distances between all pairs of nodes of degree 1.
The Matula-Goebel number of a rooted tree can be defined in the following recursive manner: to the one-vertex tree there corresponds the number 1; to a tree T with root degree 1 there corresponds the t-th prime number, where t is the Matula-Goebel number of the tree obtained from T by deleting the edge emanating from the root; to a tree T with root degree m >= 2 there corresponds the product of the Matula-Goebel numbers of the m branches of T.

Examples

			a(7)=6 because the rooted tree with Matula-Goebel number 7 is the rooted tree Y (2+2+2=6).
		

Crossrefs

Programs

  • Maple
    with(numtheory): TW := proc (n) local r, s, LV, EPL, Tw: r := proc (n) options operator, arrow: op(1, factorset(n)) end proc: s := proc (n) options operator, arrow: n/r(n) end proc: LV := proc (n) if n = 1 then 0 elif n = 2 then 1 elif bigomega(n) = 1 then LV(pi(n)) else LV(r(n))+LV(s(n)) end if end proc: EPL := proc (n) if n = 1 then 0 elif n = 2 then 1 elif bigomega(n) = 1 then EPL(pi(n))+LV(pi(n)) else EPL(r(n))+EPL(s(n)) end if end proc: Tw := proc (n) if n = 1 then 0 elif bigomega(n) = 1 then Tw(pi(n)) else Tw(r(n))+Tw(s(n))+EPL(r(n))*LV(s(n))+EPL(s(n))*LV(r(n)) end if end proc: if n = 1 then 0 elif bigomega(n) = 1 and bigomega(pi(n)) = 1 then TW(pi(n))+LV(pi(n)) elif bigomega(n) = 1 then TW(pi(n))+EPL(n) else Tw(r(n))+Tw(s(n))+EPL(r(n))*LV(s(n))+EPL(s(n))*LV(r(n)) end if end proc; seq(TW(n), n = 1 .. 90);

Formula

Let LV(m) and EPL(m) denote the number of leaves and the external path length, respectively, of the rooted tree with Matula number m (see A109129 and A196048, where LV(m) and EPL(m) are obtained recursively). a(1)=0; if n=p(t) (=the t-th prime) and t is prime, then a(n) = a(t) + LV(t); if n=p(t) (=the t-th prime) and t is not prime, then a(n) = a(t) + LV(t) + EPL(t). Now assume that n is not prime; it can be written n=rs, where r is prime and s >= 2. If s is prime, then a(n) = a(r) - EPL(r) + a(s) - EPL(s) + EPL(r)*LV(s) + EPL(s)*LV(r); if s is not prime, then a(n) = a(r) - EPL(r) + a(s) + EPL(r)*LV(s) + EPL(s)*LV(r); the Maple program is based on this recursive formula.
If m > 2 then a(2^m) = m(m-1) because the rooted tree with Matula-Goebel number 2^m is a star with m edges and the vertices of each of the binomial(m,2) pairs of nodes of degree 1 are at distance 2.

A343006 Internal path length of the rooted tree with Matula-Goebel number n.

Original entry on oeis.org

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

Views

Author

François Marques, Apr 02 2021

Keywords

Comments

The internal path length of a rooted tree is defined as the sum of the distances of all internal nodes to the root.
The Matula-Goebel number of a rooted tree is defined in the following recursive manner: to the one-vertex tree there corresponds the number 1; to a tree T with root degree 1 there corresponds the t-th prime number, where t is the Matula-Goebel number of the tree obtained from T by deleting the edge emanating from the root; to a tree T with root degree m >= 2 there corresponds the product of the Matula-Goebel numbers of the m branches of T.

Examples

			a(7) = 1 because the rooted tree with Matula-Goebel number 7 is the rooted tree Y (0+1).
a(2^m) = 0 because the rooted tree with Matula-Goebel number 2^m is a star with m edges and therefore has only one internal node: its root.
a(3^m) = m because the rooted tree with Matula-Goebel number 3^m is a star with m branches of length 2, so the internal nodes are the root and the m nodes attached to it.
		

Crossrefs

Programs

  • PARI
    InIpl(n)={ if(n==1, return([0,0]),
        my(f=factor(n)~, v=Mat(vector(#f,k,InIpl(primepi(f[1,k]))~))  );
        return( [ 1+sum(k=1,#f,v[1,k]*f[2,k]) , sum(k=1,#f,(v[1,k]+v[2,k])*f[2,k]) ] ) )
    };
    A343006(n) = InIpl(n)[2];

Formula

a(n) = A196047(n) - A196048(n).
a(r*s) = a(r) + a(s).

A352288 Total cophenetic index of the rooted tree with Matula-Goebel number n.

Original entry on oeis.org

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

Views

Author

Kevin Ryde, Mar 16 2022

Keywords

Comments

Mir, Rosselló, and Rotger, define the cophenetic value of a pair of childless vertices as the depth (distance down from the root) of their deepest common ancestor, and they then define the total cophenetic index of a tree as the sum of the cophenetic values over all such pairs.
a(n) = 0 iff n is in A325663, being rooted stars with any arm lengths, since the root (depth 0) is the common ancestor of every childless pair.
An identity relating the childless terminal Wiener index TW(n) = A348959(n) can be constructed by noting it measures distances from a pair of childless vertices to their common ancestor, and the cophenetic values measure from that ancestor up to the root. So 2*a(n) + TW(n) is total depths Ext(n) = A196048(n) of the childless vertices, repeated by childless vertices C(n) = A109129(n) except itself, so that 2*a(n) + TW(n) = Ext(n)*(C(n) - 1)

Examples

			For n=111, the tree and its childless pairs and deepest common ancestors are
  root  R         pair  ancestor depth
       / \         G,D     A       1
      A   B        G,E     A       1
     /|\   \       D,E     A       1
    C D E   F     any,F    R       0
    |                             ---
    G                 total a(n) = 3
		

Crossrefs

Cf. A348959 (terminal Wiener), A196048 (external length), A109129 (childless vertices).
Cf. A325663 (indices of 0's), A352289 (max by leaves).

Programs

  • PARI
    \\ See links.

Formula

a(n) = Sum_{i=1..k} a(primepi(p[i])) + binomial(C(p[i]),2), where n = p[1]*...*p[k] is the prime factorization of n with multiplicity (A027746), and C(n) = A109129(n) is the number of childless vertices.
Showing 1-5 of 5 results.