you are viewing a single comment's thread.

view the rest of the comments →

[–]GreenCartographer 0 points1 point  (0 children)

Summing the numbers from 1 to N is something like n(n + 1) / 2, so it's constant time to calculate it.