This solution is outdated. To rescore this solution, sign in.
-
1 Comment
Matt
on 30 Jan 2014
Compared this solution score to sum(1:n). Using tic toc and varying sizes of n repeated up to 1,000,000 times I found that n*(n+1)/2 is by far faster. On the order of 10,000 times faster.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!