Cody

# Problem 43135. Performance - summation

Solution 1664369

Submitted on 1 Nov 2018 by James
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 = 7.3919e+11 ans = 5.7505e+11 ans = 4.6812e+11 ans = 3.4565e+11 ans = 8.0627e+10 ans = 7.9425e+11 ans = 4.0271e+11 ans = 8.7305e+10 ans = 3.7916e+10 ans = 1.0929e+12 ans = 1.3897e+12 ans = 1.0824e+12 ans = 947887570 ans = 1.0792e+12 ans = 1.0405e+12 ans = 3.8283e+11 ans = 1.3812e+12 ans = 7.5045e+11 ans = 5.4185e+11 ans = 2.3688e+11 ans = 2.2145e+11 ans = 8.7420e+11 ans = 2.8405e+11 ans = 2.1106e+11 ans = 1.3543e+10 ans = 5.7517e+11 ans = 3.4791e+11 ans = 9.7769e+11 ans = 1.4355e+12 ans = 7.8683e+11