# Parity Pattern of Triangle Numbers

I noticed that the triangle numbers given by $$\frac{n(n+1)}{2}$$ have a parity pattern of odd, odd, even, even, ... and I'm curious as to why.

E.g:

n       T(n)    P(T(n))
1        1       1
2        3       1
3        6       0
4        10      0
5        15      1
6        21      1
7        28      0
8        36      0
9        45      1
10       55      1
11       66      0
12       78      0
13       91      1
14       105     1


I can see that the parities for $$n^2+n$$ are all 0, as in:

n       F(n)    P(F(n))
1        2       0
2        6       0
3        12      0
4        20      0
5        30      0
6        42      0
7        56      0


but I'm having trouble seeing why halving these values leads to the odd, odd, even, even,... pattern for the triangle numbers.

Can anyone shed some light please?

• Hint : Exactly one of $n,n+1$ is even. When is $n(n+1)$ be disivible by $4$ making the triangle number even ? Commented Aug 13, 2022 at 9:14
• Sorry, n^2 + n. Commented Aug 13, 2022 at 10:40
• Consider the difference between a triangle number and its predecessor: $$\frac12n(n+1)-\frac12(n-1)n = n$$ Since $n$ alternates between even and odd, the triangle numbers alternate between matching and not-matching their predecessors' parity.
– Blue
Commented Aug 13, 2022 at 10:50

## 3 Answers

If $$n\equiv 1 \mod 4$$ or $$n\equiv 2 \mod 4$$, then out of $$n$$ and $$(n+1),$$ one of them is odd, and the other is divisible by $$2$$ but not $$4,$$ and so $$n(n+1)/2$$ is not divisible by $$2.$$

If $$n\equiv 3 \mod 4$$ or $$n\equiv 4 \mod 4$$, then out of $$n$$ and $$(n+1),$$ one of them is odd, and the other is divisible by $$4,$$ and so $$n(n+1)/2$$ is even.

You can divide $$n$$ by $$4$$ and write $$n=4a+k$$ where $$a$$ is some integer and $$k=0, 1, 2,$$ or $$3$$. Then

$$\frac{n(n+1)}{2} = \frac{(4a+k)(4a+k+1)}{2} = \frac{16a^2+8ak+4a+k^2+k}{2}$$

$$= 8a^2+4ak+2a +\frac{k^2+k}{2}$$

Which is an even integer plus $$\frac{k^2+k}{2}$$.

If we plug in the values $$0, 1, 2, 3$$ for $$k$$, we see the pattern:

$$0, 1, 3, 6$$

which goes even odd odd even.

First is odd, we add an even number,that gives us odd again, we add an odd number we get even number, we add an even number we get an even number, continues starting from the next one.