%I #38 Jun 26 2024 09:33:17
%S 0,0,0,0,1,1,0,0,4,4,4,0,0,0,10,0,0,2,0,1,1,10,2,0,20,2,6,0,1,6,10,0,
%T 20,1,4,2,0,0,6,1,2,0,0,4,13,6,6,0,0,14,4,0,0,6,35,0,1,6,1,6,2,20,2,0,
%U 13,13,0,0,13,1,1,2,0,2,24,0,10,3,4,1,12,6,6,0,10,0,14,4,0,13,2,2,35,13
%N Sum of the distances between all unordered pairs of vertices of degree 2 in the rooted tree with Matula-Goebel number n.
%C 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.
%H Emeric Deutsch, <a href="http://arxiv.org/abs/1111.4288">Rooted tree statistics from Matula numbers</a>, arXiv:1111.4288 [math.CO], 2011.
%H F. Goebel, <a href="http://dx.doi.org/10.1016/0095-8956(80)90049-0">On a 1-1-correspondence between rooted trees and natural numbers</a>, J. Combin. Theory, B 29 (1980), 141-143.
%H I. Gutman and A. Ivic, <a href="http://dx.doi.org/10.1016/0012-365X(95)00182-V">On Matula numbers</a>, Discrete Math., 150, 1996, 131-142.
%H I. Gutman and Yeong-Nan Yeh, <a href="http://www.emis.de/journals/PIMB/067/3.html">Deducing properties of trees from their Matula numbers</a>, Publ. Inst. Math., 53 (67), 1993, 17-22.
%H A. Ilic and M. Ilic, <a href="http://arxiv.org/abs/1106.2986">Generalizations of Wiener polarity index and terminal Wiener index</a>, arXiv:11106.2986 [math.CO], 2011-2012.
%H D. W. Matula, <a href="http://www.jstor.org/stable/2027327">A natural rooted tree enumeration by prime factorization</a>, SIAM Rev. 10 (1968) 273.
%H <a href="/index/Mat#matula">Index entries for sequences related to Matula-Goebel numbers</a>
%F We give recurrence formulas for the more general case of vertices of degree k (k>=2). Let bigomega(n) denote the number of prime divisors of n, counted with multiplicities. Let g(n)=g(n,k,x) be the generating polynomial of the vertices of degree k of the rooted tree with Matula-Goebel number n with respect to level. We have a(1) = 0; if n = prime(t) and bigomega(t)=k-1 then a(n) = a(t)+[dg(t)/dx]_{x=1}; if n = prime(t) and bigomega(t)=k, then a(n) = a(t)-[dg(t)/dx]_{x=1}; if n = prime(t) and bigomega(t) =/ k and =/ k-1, then a(n)= a(t); if n = r*s with r prime, s>=2, bigomega(s)=k-1, then a(n) = a(r) + a(s) + [d[g(r)g(s)]/dx]_{x=1} +[dg(r)/dx]_{x=1} +[dg(s)/dx]_{x=1}; if n = r*s with r prime, s>=2, bigomega(s) =k, then a(n) = a(r) + a(s) + [d[g(r)g(s)]/dx]_{x=1} - [dg(r)/dx]_{x=1} - [dg(s)/dx]_{x=1}; if n = r*s with r prime, s>=2, bigomega(s) != k-1 and != k, then a(n) = a(r) + a(s) + [d[g(r)g(s)]/dx]_{x=1}.
%e a(11)=4 because the rooted tree with Matula-Goebel number 11 is the path tree A - B - C - D - E; the vertices of degree 2 are B, C, and D; we have dist(B,C)+dist(B,D)+dist(C,D) = 1+2+1 = 4.
%e a(987654321) = 68, as given by the Maple program; the reader can verify this on the rooted tree of Fig. 2 of the Deutsch reference.
%p k := 2: with(numtheory): g := proc (n) local r, s: r := proc (n) options operator, arrow: op(1, factorset(n)) end proc: s := proc (n) options operator, arrow: n/r(n) end proc: if n = 1 then 0 elif bigomega(n) = 1 and bigomega(pi(n)) = k-1 then sort(expand(x+x*g(pi(n)))) elif bigomega(n) = 1 and bigomega(pi(n)) = k then sort(expand(-x+x*g(pi(n)))) elif bigomega(n) = 1 and bigomega(pi(n)) <> k-1 and bigomega(pi(n)) <> k then sort(expand(x*g(pi(n)))) elif bigomega(s(n)) = k-1 then sort(expand(1+g(r(n))+g(s(n)))) elif bigomega(s(n)) = k then sort(expand(-1+g(r(n))+g(s(n)))) else sort(g(r(n))+g(s(n))) end if end proc; with(numtheory): a := proc (n) local r, s: r := proc (n) options operator, arrow: op(1, factorset(n)) end proc: s := proc (n) options operator, arrow: n/r(n) end proc: if n = 1 then 0 elif bigomega(n) = 1 and bigomega(pi(n)) = k-1 then a(pi(n))+subs(x = 1, diff(g(pi(n)), x)) elif bigomega(n) = 1 and bigomega(pi(n)) = k then a(pi(n))-subs(x = 1, diff(g(pi(n)), x)) elif bigomega(n) = 1 and bigomega(pi(n)) <> k and bigomega(pi(n)) <> k-1 then a(pi(n)) elif bigomega(s(n)) = k-1 then a(r(n))+a(s(n))+subs(x = 1, diff(g(r(n))*g(s(n)), x))+subs(x = 1, diff(g(r(n)), x))+subs(x = 1, diff(g(s(n)), x)) elif bigomega(s(n)) = k then a(r(n))+a(s(n))+subs(x = 1, diff(g(r(n))*g(s(n)), x))-subs(x = 1, diff(g(r(n)), x))-subs(x = 1, diff(g(s(n)), x)) else a(r(n))+a(s(n))+subs(x = 1, diff(g(r(n))*g(s(n)), x)) end if end proc: seq(a(n), n = 1 .. 120);
%t k = 2;
%t r[n_] := FactorInteger[n][[1, 1]];
%t s[n_] := n/r[n];
%t g[n_] := Which[n == 1, 0,
%t PrimeOmega[n] == 1 && PrimeOmega[PrimePi[n]] == k - 1,
%t Expand[x + x*g[PrimePi[n]]] ,
%t PrimeOmega[n] == 1 && PrimeOmega[PrimePi[n]] == k,
%t Expand[-x + x*g[PrimePi[n]]],
%t PrimeOmega[n] == 1 && PrimeOmega[PrimePi[n]] != k - 1 &&
%t PrimeOmega[PrimePi[n]] != k, Expand[x*g[PrimePi[n]]],
%t PrimeOmega[s[n]] == k - 1, Expand[1 + g[r[n]] + g[s[n]]],
%t PrimeOmega[s[n]] == k, Expand[-1 + g[r[n]] + g[s[n]]], True,
%t g[r[n]] + g[s[n]]];
%t a[n_] := Which[n == 1, 0,
%t PrimeOmega[n] == 1 && PrimeOmega[PrimePi[n]] == k - 1,
%t a[PrimePi[n]] + (D[g[PrimePi[n]], x] /. x -> 1),
%t PrimeOmega[n] == 1 && PrimeOmega[PrimePi[n]] == k,
%t a[PrimePi[n]] - (D[g[PrimePi[n]], x] /. x -> 1),
%t PrimeOmega[n] == 1 && PrimeOmega[PrimePi[n]] != k &&
%t PrimeOmega[PrimePi[n]] != k - 1, a[PrimePi[n]],
%t PrimeOmega[s[n]] == k - 1,
%t a[r[n]] + a[s[n]] + (D[g[r[n]]*g[s[n]], x] /. x -> 1) +
%t (D[g[r[n]], x] /. x -> 1) + (D[g[s[n]], x] /. x -> 1) ,
%t PrimeOmega[s[n]] == k,
%t a[r[n]] + a[s[n]] + (D[g[r[n]]*g[s[n]], x] /. x -> 1) -
%t (D[g[r[n]], x] /. x -> 1) - (D[g[s[n]], x] /. x -> 1), True,
%t a[r[n]] + a[s[n]] + (D[g[r[n]]*g[s[n]], x] /. x -> 1) ];
%t Table[a[n], {n, 1, 120}] (* _Jean-François Alcover_, Jun 19 2024, after Maple code *)
%Y Cf. A206499, A212619, A212620, A212621, A212622, A212623, A212624, A212625, A212626, A212627, A212628, A212629, A212630, A212631, A212632.
%K nonn
%O 1,9
%A _Emeric Deutsch_, May 22 2012