Counting Regular polygons in Complete Graphs

The figure shows the correct $24-$gon, which held all the diagonals.

a) Find out how we got right triangles and squares (question for arbitrary $n$)?

b) How this problem can be generalized (if it is possible, of course)?  My work so far:

That there were squares, you need to have the diagonals are perpendicular. This means that the number of vertices of a multiple of $4$. Similarly, to get the equilateral triangles, the number of vertices must be a multiple of $3$. If $n = 5$, for example, or squares or triangles will not. It does not bother. How to calculate the number of regular polygons? The main difficulty here is to count the number of degenerate triangles, ie triples diagonal angles of 60, which intersect at the same point, if it is not the center.

Problem: Find the number of regular polygons in the complete graph

For example:

Let $D_3(n) -$ number of equilateral triangles in a complete graph with $n$ vertices, $D_4(n) -$number of squares in a complete graph with $n$ vertices.

Then $3 \not| n \Rightarrow D_(n)=0$, for example, $D_3(5)=0$,

$4 \not| n \Rightarrow D_(n)=0$, for example, $D_4(5)=0$.

But $3|24$ and $4|n$, then $D_3(24)>0$ and $D_4(24)>0$.

Question: $D_3(24)-?, D_4(24)-?, D_3(n)-?, D_4(n)-?, D_k(n)-?$

• Figure 2 shows equilateral triangles. Is that what you meant by "right" triangles? – David K Mar 14 '16 at 1:14
• Is this machine translated? I can't parse a single sentence in this question... – Hans Lundmark Mar 15 '16 at 19:31
• I do not know much English. I use machine translation – Roman83 Mar 15 '16 at 19:45