OFFSET
1,2
COMMENTS
An equilateral triangle is located in the coordinate plane Oxy so that its center coincides with the origin O, one of the vertices lies on the Oy axis.
LINKS
Nicolay Avilov, Illustration of initial terms
FORMULA
a(n) = (3*n - 2)/2 + 2*Sum_{k=1..floor(sqrt(3)*n/2)} floor(-sqrt(3)*k + 3*n/2) if n is even;
a(n) = (3*n - 1)/2 + 2*Sum_{k=1..floor(sqrt(3)*n/2)} floor(-sqrt(3)*k + (3*n + 1)/2) if n is odd.
EXAMPLE
a(3) = 4 + 2*4 = 12;
a(4) = 5 + 2*6 = 17.
MATHEMATICA
a[n_]:=(3n-2+Mod[n, 2])/2+2Sum[Floor[(3n+Mod[n, 2])/2-Sqrt[3]k], {k, Floor[Sqrt[3]n/2]}]; Array[a, 53] (* Stefano Spezia, May 08 2023 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Nicolay Avilov, May 07 2023
STATUS
approved