Cody

# Problem 43135. Performance - summation

Solution 1353375

Submitted on 22 Nov 2017 by SUBROTA HALDER
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 = 1.1628e+11 y = 3.7752e+10 y = 1.9593e+10 y = 1.0658e+12 y = 1.3652e+12 y = 1.2901e+09 y = 5.0072e+11 y = 3.4220e+11 y = 7.1141e+11 y = 2.1501e+10 y = 1.4253e+12 y = 2.8996e+11 y = 5.7336e+11 y = 1.1586e+12 y = 9.5793e+11 y = 1.2926e+12 y = 1.3514e+12 y = 1.0723e+12 y = 1.0653e+12 y = 7.1745e+11 y = 3.7274e+10 y = 6.2561e+10 y = 9.1815e+11 y = 2.1943e+11 y = 3.8540e+11 y = 4.4273e+11 y = 5.6232e+11 y = 5.3975e+11 y = 5.1694e+11 y = 1.0625e+11

### Community Treasure Hunt

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

Start Hunting!