OFFSET
0,6
COMMENTS
For n >= 3, number of solutions to x+y+z == 0 (mod n) with 0 <= x < y < z < n. E.g., for n=3 there is a unique solution, x=0, y=1, z=2.
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
S. A. Burr, B. Grünbaum, and N. J. A. Sloane, The Orchard Problem, Geometriae Dedicata, 2 (1974), 397-424.
Index entries for linear recurrences with constant coefficients, signature (2,-1,1,-2,1).
FORMULA
From Paul Barry, Mar 18 2004: (Start)
G.f.: (1 - 2x + x^2 + x^4)/((1 - x)^2(1 - x^3)).
a(n) = 4*cos(2*Pi*n/3)/9 + (3*n^2 - 9*n + 10)/18. (End)
E.g.f.: (exp(x)*(10 - 6*x + 3*x^2) + 8*exp(-x/2)*cos(sqrt(3)*x/2))/18. - Stefano Spezia, May 03 2023
Sum_{n>=3} 1/a(n) = 6 - (2*Pi/sqrt(3))*(1 - tanh(sqrt(5/3)*Pi/2)/sqrt(5)). - Amiram Eldar, May 06 2023
MATHEMATICA
Table[Floor[(n(n-3))/6]+1, {n, 0, 70}] (* or *) LinearRecurrence[{2, -1, 1, -2, 1}, {1, 0, 0, 1, 1}, 70] (* Harvey P. Dale, Jun 21 2021 *)
PROG
(Sage) [ceil(binomial(n, 2)/3) for n in range(-1, 55)] # Zerinvary Lajos, Dec 03 2009
(Haskell)
a058212 n = 1 + n * (n - 3) `div` 6 -- Reinhard Zumkeller, May 08
(PARI) a(n)=n*(n-3)\6 + 1 \\ Charles R Greathouse IV, Jun 11 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Nov 30 2000
EXTENSIONS
Zerinvary Lajos, Dec 07 2009
STATUS
approved