Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think he meant factorial rather than sum.

The sum of the numbers is O(1) - you can calculate it algorithmically.

N*(N+1)/2

Ref: http://www.wikihow.com/Sum-the-Integers-from-1-to-N






Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: