Cody

# Problem 43135. Performance - summation

Solution 2140655

Submitted on 25 Feb 2020 by Gatech AE
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

y = 7.4348e+11 y = 1.4021e+11 y = 1.1202e+12 y = 1.0810e+12 y = 6.6699e+10 y = 6.3260e+10 y = 6.4824e+11 y = 2.9832e+11 y = 7.9164e+10 y = 5.5414e+11 y = 1.3109e+12 y = 8.7366e+10 y = 1.2339e+12 y = 8.1764e+11 y = 5.6358e+09 y = 9.9618e+10 y = 5.3837e+10 y = 3.0315e+10 y = 2.9787e+10 y = 3.0672e+11 y = 2.3608e+11 y = 2.4162e+09 y = 5.9530e+10 y = 2.8758e+10 y = 2.6094e+10 y = 7.5010e+11 y = 9.6599e+11 y = 1.5146e+11 y = 9.2133e+11 y = 8.4209e+11

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!