Cody

# Problem 43135. Performance - summation

Solution 1021974

Submitted on 18 Oct 2016 by Marco Tullio
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
for k=1:30 N = randi(1701034); tic; S = sum(1:N); elapsedSum = toc; tic; Y = performance(N); elapsedPerf = toc; assert(isequal(S,Y),'Not equal sums'); assert(elapsedPerf < elapsedSum,'Not performing better than sum(1:N)'); end

ans = 4.4173e+11 ans = 5.7629e+10 ans = 2.4552e+11 ans = 4.6548e+11 ans = 6.6366e+11 ans = 4.5195e+11 ans = 3.1643e+10 ans = 4.5505e+11 ans = 1.3685e+11 ans = 1.2260e+12 ans = 2.2002e+11 ans = 1.4175e+12 ans = 6.9901e+10 ans = 4.3813e+11 ans = 9.2667e+11 ans = 2.5887e+11 ans = 3.3403e+11 ans = 1.6785e+10 ans = 1.3269e+12 ans = 2.1888e+11 ans = 1.6970e+10 ans = 3.4227e+11 ans = 2.4034e+09 ans = 4.0672e+09 ans = 7.7088e+11 ans = 3.1485e+11 ans = 1.3005e+12 ans = 2.4271e+09 ans = 7.8792e+11 ans = 9.8272e+11