also contains triangle number problem