Cody

Solution 1017197

Submitted on 14 Oct 2016 by Jean-Marie Sainthillier
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.2869e+10 ans = 9.5653e+10 ans = 5.4067e+10 ans = 7.9208e+11 ans = 4.9844e+11 ans = 5.1693e+11 ans = 1.2322e+11 ans = 1.0289e+12 ans = 1.1472e+12 ans = 9.5114e+11 ans = 7.9403e+11 ans = 1.6807e+10 ans = 5.9533e+11 ans = 1.6746e+10 ans = 2.5359e+11 ans = 9.9861e+11 ans = 1.3916e+12 ans = 9.0658e+11 ans = 1.0992e+12 ans = 1.4027e+09 ans = 1.4149e+12 ans = 1.2037e+12 ans = 8.9415e+11 ans = 1.1489e+12 ans = 3.0265e+10 ans = 5.0910e+09 ans = 4.0663e+11 ans = 5.0638e+10 ans = 8.6221e+11 ans = 3.0407e+11