Changed way triangular numbers are evaluated. Now in O(n), was O(n^2) (?)