OFFSET
1,2
COMMENTS
A 2-multigraph is similar to an ordinary graph except there are 0, 1 or 2 edges between any two nodes (self-loops are not allowed).
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..50
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) = {sum(i=2, #v, sum(j=1, i-1, if(v[i]*v[j]%2==0, gcd(v[i], v[j])))) + sum(i=1, #v, if(v[i]%2==0, v[i]\4*2+1))}
a(n) = {my(s=0); forpart(p=n, s+=permcount(p)*3^edges(p)); s/n!} \\ Andrew Howroyd, Sep 16 2018
(Python)
from itertools import combinations
from math import prod, gcd, factorial
from fractions import Fraction
from sympy.utilities.iterables import partitions
def A052111(n): return int(sum(Fraction(3**(sum(p[r]*p[s]*gcd(r, s) for r, s in combinations(p.keys(), 2) if not (r&1 and s&1))+sum(((q>>1)|1)*r+(q*r*(r-1)>>1) for q, r in p.items() if q&1^1)), prod(q**r*factorial(r) for q, r in p.items())) for p in partitions(n))) # Chai Wah Wu, Jul 09 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladeta Jovovic, Jan 21 2000
EXTENSIONS
Terms a(17) and beyond from Andrew Howroyd, Sep 16 2018
STATUS
approved