Faster way for generating triangle numbers