Problem: For each integer $n\geq3$ , let $f(n)$ be the number of $3$ -element subsets of the vertices of the regular $n$ -gon that are the vertices of an isosceles triangle (including equilateral triangles). Find the sum of all values of $n$ such that $f(n+1)=f(n)+78$

Solution: In the case that $n\equiv 0\pmod 3$ , there are $\frac{n}{3}$ equilateral triangles. We will now count the number of non-equilateral isosceles triangles in this case.
Select a vertex $P$ of a regular $n$ -gon. We will count the number of isosceles triangles with their vertex at $P$ . (In other words, we are counting the number of isosceles triangles $\triangle APB$ with $A, B, P$ among the vertices of the $n$ -gon, and $AP=BP$ .)
If the side $AP$ spans $k$ sides of the $n$ -gon (where $k<\frac{n}{2}$ ), the side $BP$ must span $k$ sides of the $n$ -gon, and, thus, the side $AB$ must span $n-2k$ sides of the $n$ -gon. As $\triangle ABP$ has three distinct vertices, the side $AB$ must span at least one side, so $n-2k \ge 1$ . Combining this inequality with the fact that $1\le k<\frac{n}{2}$ and $k\not = \frac{n}{3}$ (as $\triangle ABP$ cannot be equilateral), we find that there are $\lceil\frac{n}{2}\rceil-2$ possible $k$
As each of the $n$ vertices can be the vertex of a given triangle $\triangle ABP$ , there are $\left(\lceil \frac{n}{2} \rceil -2 \right)\cdot n$ non-equilateral isosceles triangles.
Adding in the $\frac{n}{3}$ equilateral triangles, we find that for $n\equiv 0\pmod 3$ $f(n) = \frac{n}{3}+\left(\lceil \frac{n}{2} \rceil -2\right)\cdot n$
On the other hand, if $n\equiv 1, 2\pmod 3$ , there are no equilateral triangles, and we may follow the logic of the paragraph above to find that $f(n)=\left(\lceil \frac{n}{2} \rceil -1\right)\cdot n$
We may now rewrite the given equation, based on the remainder $n$ leaves when divided by 3.
Case 1: $n\equiv 0\pmod 3$ The equation $f(n+1)=f(n)+78$ for this case is $\left(\lceil \frac{n+1}{2} \rceil -1\right)\cdot (n+1)=\frac{n}{3}+\left(\lceil \frac{n}{2} \rceil -2\right)\cdot n+78$
In this case, $n$ is of the form $6k$ or $6k+3$ , for some integer $k$
Subcase 1: $n=6k$ Plugging into the equation above yields $k=6\rightarrow n=36$
Subcase 2: $n=6k+3$ Plugging into the equation above yields $7k=75$ , which has no integer solutions.
Case 2: $n\equiv 1\pmod 3$ The equation $f(n+1)=f(n)+78$ for this case is $\left(\lceil \frac{n+1}{2} \rceil -1\right)\cdot (n+1)=\left(\lceil \frac{n}{2} \rceil -1\right)\cdot n+78$
In this case, $n$ is of the form $6k+1$ or $6k+4$ , for some integer $k$
Subcase 1: $n=6k+1$ In this case, the equation above yields $k=8\rightarrow n=52$
Subcase 2: $n=6k+4$ In this case, the equation above yields $k=26\rightarrow n=157$
Case 3: $n\equiv 2\pmod 3$ The equation $f(n+1)=f(n)+78$ for this case is $\frac{n+1}{3}+\left(\lceil \frac{n+1}{2} \rceil -2\right)\cdot (n+1)=\left(\lceil \frac{n}{2} \rceil -1\right)\cdot n+78$
In this case, $n$ is of the form $6k+2$ or $6k+5$ , for some integer $k$
Subcase 1: $n=6k+2$ The equation above reduces to $5k=77$ , which has no integer solutions.
Subcase 2: $n=6k+5$ The equation above reduces to $k=-80$ , which does not yield a positive integer solution for $n$
In summary, the possible $n$ are $36, 52, 157$ , which add to $\boxed{245}$

Answer:  245