>>11980475Every positive integer ?3mod8 can be written as a sum of three squares; see here for a proof (in fact, more integers than just those can be so written).
The result about triangular numbers follows from that result: let n>0; then 8n+3 is a sum of three squares. From congruence conditions modulo 4, it follows that each square is odd, so that
8n+3=(2x+1)^2+(2y+1)^2+(2z+1)^2=4x^2+4x+4y^2+4y+4z^2+4z+3,
so that
8n=4x(x+1)+4y(y+1)+4z(z+1).
The result follows upon dividing through by 8.