For an equilateral triangle of side length $n$ dots, as shown in this diagram below, construct a function, $f(n)$, which outputs the number of lines needed to connect up every dot to every other dot. A straight line through three or more dots counts as only one line! E.g. $f(3) = 9$ and $f(4) = 24$.
Can anyone point me in the right direction with this problem? Perhaps tell me what area of mathematics or what concepts would help me solve this? If this is a trivial problem don't give the answer but tell let me know. Thanks.

For a side of $m$ dots there are a total of $n=\frac 12m(m+1)$ dots. There are then $\frac 12n(n-1)$ pairs of dots. If you have a line with $k \gt 2$ dots on it, it accounts for $\frac 12k(k-1)$ of the pairs of dots, so it reduces the count by $\frac 12k(k-1)-1$
We can see this for the order $4$ triangle. There are $10$ points, three lines with four points (the sides) and three lines with three points. The number of lines is then $\frac 12\cdot 10 \cdot 9 - 3(\frac 12\cdot 4 \cdot 3-1)-3(\frac 12 \cdot 3 \cdot 2 -1)=45-3\cdot 5 -3 \cdot 2=24$
If we do the order $5$ triangle we have $15$ dots, three lines with five dots, three with four dots, and six with three dots. The new ones with three dots run from a corner through the center to the middle of the other side. This gives $\frac 12\cdot 15\cdot 14-3\cdot 9-3\cdot 5 -6\cdot 2=51$ lines
This gives sequence A244504 which begins $$3, 9, 24, 51, 102, 177, 294, 459, 690, 987, 1380, 1875, 2508, 3279, 4212, 5319, 6648, 8199, 10026, 12141, 14580, 17343, 20496, 24051, 28068, 32547, 37542, 43071, 49218, 55983, 63456, 71661, 80658, 90447, 101100, 112635, 125160, 138675, 153252, 168915, 185784$$
No closed formula is given.