OFFSET
3,1
COMMENTS
Let f(u) be the number of unordered vertex pairs at distance u in a regular n-gon; then a(n) = sum over u of f(u)^2.
LINKS
Bernat Espigule, Table of n, a(n) for n = 3..10000
Index entries for linear recurrences with constant coefficients, signature (1,3,-3,-3,3,1,-1).
FORMULA
a(n) = n^2*(n-1)/2 for odd n; a(n) = n^2*(2*n-3)/4 for even n.
a(n) = [x^n] x^3*(9 + 11*x + 3*x^2 - 2*x^3 + 3*x^4 + x^5 - x^6)/((x - 1)^4*(x + 1)^3). - Peter Luschny, Sep 16 2025
EXAMPLE
n = 8: distances correspond to chord steps k = 1, 2, 3 with multiplicity 8 each, and the diameter k = 4 with multiplicity 4. Thus a(8) = 8^2 + 8^2 + 8^2 + 4^2 = 208.
MATHEMATICA
a[n_] := n^2 Floor[(n - 1)/2] + If[EvenQ[n], (n/2)^2, 0];
Table[a[n], {n, 3, 30}]
PROG
(Python)
def A387858(n): return n**2*(n-1)>>1 if n&1 else (n>>1)**2*((n<<1)-3) # Chai Wah Wu, Oct 29 2025
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Bernat Espigule, Sep 10 2025
STATUS
approved
