Cody

Solution 1687282

Submitted on 6 Dec 2018 by Martin C.
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.0166e+12 y = 3.9174e+11 y = 3.3356e+11 y = 1.8479e+09 y = 3.6132e+11 y = 7.8382e+09 y = 5.7757e+11 y = 7.5877e+10 y = 1.7070e+11 y = 8.0444e+11 y = 1.2983e+12 y = 7.1158e+11 y = 2.8394e+11 y = 8.2073e+11 y = 5.7873e+11 y = 2.6109e+09 y = 5.2855e+11 y = 1.1541e+12 y = 1.2894e+12 y = 5.2870e+10 y = 4.1929e+10 y = 8.2626e+11 y = 2.1455e+11 y = 1.2037e+12 y = 1.4464e+12 y = 1.1689e+12 y = 1.2023e+12 y = 2.3832e+11 y = 4.8718e+11 y = 9.7743e+11