Polygonal number theorem