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

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

Original entry on oeis.org

0, 1, 4, 4, 10, 10, 9, 9, 20, 20, 20, 18, 18, 18, 35, 16, 18, 31, 16, 32, 32, 35, 31, 28, 56, 31, 48, 29, 32, 50, 35, 25, 56, 32, 52, 44, 28, 28, 50, 46, 31, 46, 29, 52, 72, 48, 50, 40, 48, 75, 52, 46, 25, 64, 84, 42, 46, 50, 32, 67, 44, 56, 67, 36, 76, 76, 28, 48, 72, 70, 46, 59, 46, 44, 102, 42, 79, 68, 52, 62, 88, 50, 48, 62, 79, 46, 75, 71, 40, 92, 71, 67, 84, 72, 71, 54, 75, 65, 104, 96
Offset: 1

Views

Author

Emeric Deutsch, Sep 27 2011

Keywords

Comments

The Wiener index of a connected graph is the sum of the distances between all unordered pairs of vertices in the graph.
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)=9 because the rooted tree with Matula-Goebel number 7 is the rooted tree Y (1+1+1+2+2+2=9).
a(2^m) = m^2 because the rooted tree with Matula-Goebel number 2^m is a star with m edges and we have m distances 1 and m(m-1)/2 distances 2; m + m(m-1)=m^2.
		

Crossrefs

Terminal Wiener indices: A196055, A348959.

Programs

  • Haskell
    import Data.List (genericIndex)
    a196051 n = genericIndex a196051_list (n - 1)
    a196051_list = 0 : g 2 where
       g x = y : g (x + 1) where
         y | t > 0     = a196051 t + a196047 t + a196050 t + 1
           | otherwise = a196051 r + a196051 s +
                         a196047 r * a196050 s + a196047 s * a196050 r
           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, E, PL: r := proc (n) options operator, arrow: op(1, factorset(n)) end proc: s := proc (n) options operator, arrow: n/r(n) end proc: E := proc (n) if n = 1 then 0 elif bigomega(n) = 1 then 1+E(pi(n)) else E(r(n))+E(s(n)) end if end proc: PL := proc (n) if n = 1 then 0 elif bigomega(n) = 1 then 1+E(pi(n))+PL(pi(n)) else PL(r(n))+PL(s(n)) end if end proc: if n = 1 then 0 elif bigomega(n) = 1 then a(pi(n))+PL(pi(n))+1+E(pi(n)) else a(r(n))+a(s(n))+PL(r(n))*E(s(n))+PL(s(n))*E(r(n)) end if end proc: seq(a(n), n = 1 .. 100);
  • Mathematica
    r[n_] := FactorInteger[n][[1, 1]];
    s[n_] := n/r[n];
    e[n_] := Which[n == 1, 0, PrimeOmega[n] == 1, 1 + e[PrimePi[n]], True, e[r[n]] + e[s[n]]];
    PL[n_] := Which[n == 1, 0, PrimeOmega[n] == 1, 1 + e[PrimePi[n]] + PL[PrimePi[n]], True, PL[r[n]] + PL[s[n]]];
    a[n_] := Which[n == 1, 0, PrimeOmega[n] == 1, a[PrimePi[n]] + PL[PrimePi[n]] + 1 + e[PrimePi[n]], True, a[r[n]] + a[s[n]] + PL[r[n]]*e[s[n]] + PL[s[n]]*e[r[n]]];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jun 25 2024, after Maple code *)

Formula

a(1)=0; if n = prime(t) (the t-th prime), then a(n)=a(t)+PL(t)+E(t)+1; if n=rs (r,s>=2), then a(n)=a(r)+a(s)+PL(r)E(s)+PL(s)E(r); PL(m) and E(m) denote the path length and the number of edges of the rooted tree with Matula number m (see A196047, A196050). The Maple program is based on this recursive formula.

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)).
Showing 1-2 of 2 results.