|
|
A199012
|
|
The total number of edges in all unlabeled directed graphs (no self loops allowed) on n nodes.
|
|
1
|
|
|
0, 3, 48, 1308, 96080, 23114160, 18522702240, 50214057399744, 469006445678383872, 15356719437883766115840, 1788760016178073736115859200, 750205198434476437912637004278784, 1144188684031608529784893493874665232384, 6398724751986384956446081096594171272300830720
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
FORMULA
|
|
|
MAPLE
|
b:= proc(n, i, l) `if`(n=0 or i=1, 1/n!*2^((p-> add(p[j]-1+add(
igcd(p[k], p[j]), k=1..j-1)*2, j=1..nops(p)))([l[], 1$n])),
add(b(n-i*j, i-1, [l[], i$j])/j!/i^j, j=0..n/i))
end:
a:= n-> b(n$2, [])*n*(n-1)/2:
|
|
MATHEMATICA
|
Table[D[GraphPolynomial[n, x, Directed], x]/.x->1, {n, 1, 15}]
(* Second program: *)
permcount[v_] := Module[{m = 1, s = 0, k = 0, t}, For[i = 1, i <= Length[v], i++, t = v[[i]]; k = If[i > 1 && t == v[[i - 1]], k + 1, 1]; m *= t*k; s += t]; s!/m];
edges[v_, t_] := Product[g = GCD[v[[i]], v[[j]]]; t[v[[i]]*v[[j]]/g]^(2*g), {i, 2, Length[v]}, {j, 1, i - 1}] * Product[ t[v[[i]]]^(v[[i]] - 1), {i, 1, Length[v]}]
a[n_] := (s = 0; Do[s += permcount[p]*(D[edges[p, 1 + x^# &], x] /. x -> 1), {p, IntegerPartitions[n]}]; s/n!);
|
|
PROG
|
(PARI)
permcount(v) = {my(m=1, s=0, k=0, t); for(i=1, #v, t=v[i]; k=if(i>1&&t==v[i-1], k+1, 1); m*=t*k; s+=t); s!/m}
edges(v, t) = {prod(i=2, #v, prod(j=1, i-1, my(g=gcd(v[i], v[j])); t(v[i]*v[j]/g)^(2*g))) * prod(i=1, #v, t(v[i])^(v[i]-1))}
a(n) = {my(s=0); forpart(p=n, s+=permcount(p)*subst(deriv(edges(p, i->1+x^i)), x, 1)); s/n!} \\ Andrew Howroyd, Nov 05 2017
(Python)
from itertools import combinations
from math import prod, factorial, gcd
from fractions import Fraction
from sympy.utilities.iterables import partitions
def A199012(n): return (n*(n-1)>>1)*int(sum(Fraction(1<<sum(p[r]*p[s]*gcd(r, s)<<1 for r, s in combinations(p.keys(), 2))+sum(r*(q*r-1) for q, r in p.items()), prod(q**r*factorial(r) for q, r in p.items())) for p in partitions(n))) # Chai Wah Wu, Jul 05 2024
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|