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






Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: