Fastest possible summing numbers up to N
Posted
by dada
on Stack Overflow
See other posts from Stack Overflow
or by dada
Published on 2010-04-12T18:28:58Z
Indexed on
2010/04/12
18:33 UTC
Read the original article
Hit count: 251
Okay so i need really FAST algorithm or code in C if you have any it would be nice. The task is to sum all numbers from 1 to N for a given number N (it can be negative number too), so i did the usual way (you know just summing with loop from 1 to N) but it's not fast enough - i need something faster, i guess that i need the fastest possible way to do this.
If anyone could help me, please do. Thanks.
© Stack Overflow or respective owner