reviewed
approved
reviewed
approved
proposed
reviewed
editing
proposed
Frank Harary, Edgar M. Palmer, Robert W. Robinson, and Allen J. Schwenk, <a href="http://dx.doi.org/10.1002/jgt.3190010405">Enumeration of graphs with signed points and lines</a>, J. Graph Theory 1 (1977), no. 4, 295-308.
proposed
editing
editing
proposed
(Python)
from itertools import combinations
from math import prod, gcd, factorial
from fractions import Fraction
from sympy.utilities.iterables import partitions
def A004107(n): return int(sum(Fraction(3**((sum(p[r]*p[s]*gcd(r, s) for r, s in combinations(p.keys(), 2))<<1)+sum(((q&-2)+q*(r-1))*r 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 09 2024
approved
editing
proposed
approved
editing
proposed
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_] := 2 Sum[Sum[GCD[v[[i]], v[[j]]], {j, 1, i - 1}], {i, 2, Length[v]}] + Sum[2 Quotient[v[[i]], 2], {i, 1, Length[v]}];
a[n_] := Module[{s = 0}, Do[s += permcount[p]*3^edges[p], {p, IntegerPartitions[n]}]; s/n!];
Array[a, 12, 0] (* Jean-François Alcover, Aug 17 2019, after Andrew Howroyd *)
approved
editing
Andrew Howroyd, <a href="/A004107/b004107_1.txt">Table of n, a(n) for n = 0..40</a> (terms 1..13 from R. W. Robinson)