#### Hide answer & extension

Let \(T_a\) represent the \(a\)^{th} triangle number. This means that \(T_a=\frac{1}{2}a(a+1)\).

Suppose that for some integer \(n\), \(n^2 \leq T_a <(n+1)^2\). This means that:

$$n^2 \leq T_a$$
$$n^2 \leq \frac{1}{2}a(a+1)$$
$$2n^2 \leq a^2+a$$

But for every positive integer \(a \leq a^2\), so:

$$2n^2 \leq 2a^2$$
$$n^2 \leq a^2$$

\(n\) and \(a\) are both positive integers, so:

$$n \leq a$$

Now consider \(T_{a+2}\):

$$T_{a+2}=\frac{1}{2}(a+2)(a+3)$$
$$=\frac{1}{2}(a^2+5a+6)$$
$$=\frac{1}{2}(a^2+a)+\frac{1}{2}(4a+6)$$
$$=\frac{1}{2}a(a+1)+2a+3$$
$$=T_a+2a+3$$

We know that \(a \geq n\) and \(T_a \geq n^2\), so:

$$T_a+2a+3 \geq n^2+2n+3$$
$$>n^2+2n+1 = (n+1)^2$$

And so \(T_{a+2}\) is not between \(n^2\) and \((n+1)^2\). So if a triangle number \(T_a\) is between \(n^2\) and \((n+1)^2\) then the next but one triangle number \(T_{a+2}\) cannot also be between \(n^2\) and \((n+1)^2\). So there cannot be more than two triangle numbers between \(n^2\) and \((n+1)^2\).

#### Extension

Given an integer \(n\), how many triangle numbers are there between \(n^2\) and \((n+1)^2\)?