OFFSET
2,4
COMMENTS
A graph with n edges is graceful if its vertices can be labeled with distinct integers in the range 0,1,...,n in such a way that when the edges are labeled with the absolute differences between the labels of their end-vertices, the n edges have the distinct labels 1,2,...,n.
LINKS
C. Barrientos and S. M. Minion, Enumerating families of labeled graphs, J. Integer Seq., 18(2015), article 15.1.7.
J. A. Gallian, A dynamic survey of graph labeling, Elec. J. Combin., (2013), #DS6.
David A. Sheppard, The factorial representation of major balanced labelled graphs, Discrete Math., 15(1976), no. 4, 379-388.
FORMULA
For n >=2, if 1 <= i <= floor(n/2), g(n,i) = (n-2)!*(n-1-i)*i; if ceiling((n+1)/2) <= i <= n-1, g(n,i) = (n-2)!*(n-i)*(i-1).
# alternative
A241094 := proc(n,i)
if n <2 or i<1 or i >= n then
0;
elif i <= floor(n/2) then
GAMMA(n-1)*(n-1-i)*i;
else
GAMMA(n-1)*(n-i)*(i-1) ;
fi ;
end proc:
seq(seq(A241094(n,i),i=1..n-1),n=2..12); # R. J. Mathar, Jul 30 2024
EXAMPLE
For n=7 and i=3, g(7,3) = 1080.
For n=7 and i=5, g(7,5) = 960.
Triangle begins:
[n\i] [1] [2] [3] [4] [5] [6] [7] [8]
[2] 0;
[3] 1, 1;
[4] 4, 4, 4;
[5] 18, 24, 24, 18;
[6] 96, 144, 144, 144, 96;
[7] 600, 960, 1080, 1080, 960, 600;
[8] 4320, 7200, 8640, 8640, 8640, 7200, 4320;
[9] 35280, 60480, 75600, 80640, 80640, 75600, 60480, 35280;
...
- Bruno Berselli, Apr 23 2014
MAPLE
Labeled:=(i, n) piecewise(n<2 or i<1, -infinity, 1 <= i <= floor(n/2), GAMMA(n-1)*(n-1-i)*i, ceil((n+1)/2) <= i <= n-1, GAMMA(n-1)*(n-i)*(i-1), infinity):
MATHEMATICA
n=10; (* This number must be replaced every time in order to produce the different entries of the sequence *)
For[i = 1, i <= Floor[n/2], i++, g[n_, i_]:=(n-2)!*(n-1-i)*i; Print["g(", n, ", ", i, ")=", g[n, i]]]
For[i = Ceiling[(n+1)/2], i <= (n-1), i++, g[n_, i_]:=(n-2)!*(n-i)*(i-1); Print["g(", n, ", ", i, ")=", g[n, i]]]
PROG
(Magma) /* As triangle: */ [[i le Floor(n/2) select Factorial(n-2)*(n-1-i)*i else Factorial(n-2)*(n-i)*(i-1): i in [1..n-1]]: n in [2..10]]; // Bruno Berselli, Apr 23 2014
CROSSREFS
KEYWORD
AUTHOR
Christian Barrientos and Sarah Minion, Apr 15 2014
STATUS
approved