Add helper function to check if given n is a triangle number.