OFFSET
1,4
COMMENTS
A graph G with n edges is harmonious if there is an injection f from its vertex set to the group of integers modulo n such that when each edge uv of G is assigned the weight f(u)+f(v) (mod n), the resulting weights are distinct.
LINKS
R. L. Graham and N. J. A. Sloane, On Additive Bases and Harmonious Graphs, SIAM J. Algebraic and Discrete Methods, 1 (1980), 382-404.
R. L. Graham and N. J. A. Sloane, On Additive Bases and Harmonious Graphs
FORMULA
For n odd, a(n) = ((n-1)/2)^n. For n even, a(n) = (n*(n-2)/4)^(n/2).
EXAMPLE
a(3)=1 because there is only one harmonious graph with 3 edges and at most 3 vertices.
MATHEMATICA
Table[If[EvenQ[n], (n*(n-2)/4)^(n/2), ((n-1)/2)^n], {n, 1, 22}] (* Stefano Spezia, Nov 24 2019 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Christian Barrientos, Nov 23 2019
STATUS
approved