considerably sped up triangluar sum problem