

A196051


The Wiener index of the rooted tree with MatulaGoebel number n.


6



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
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,3


COMMENTS

The Wiener index of a connected graph is the sum of the distances between all unordered pairs of vertices in the graph.
The MatulaGoebel number of a rooted tree can be defined in the following recursive manner: to the onevertex tree there corresponds the number 1; to a tree T with root degree 1 there corresponds the tth prime number, where t is the MatulaGoebel 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 MatulaGoebel numbers of the m branches of T.


LINKS



FORMULA

a(1)=0; if n = prime(t) (the tth 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.


EXAMPLE

a(7)=9 because the rooted tree with MatulaGoebel number 7 is the rooted tree Y (1+1+1+2+2+2=9).
a(2^m) = m^2 because the rooted tree with MatulaGoebel number 2^m is a star with m edges and we have m distances 1 and m(m1)/2 distances 2; m + m(m1)=m^2.


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]]];


PROG

(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


CROSSREFS



KEYWORD

nonn


AUTHOR



STATUS

approved



