This solution is outdated. To rescore this solution, sign in.
Sorry, but can't get code to run at all. So try to get some help this way...
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
feval(@assignin,'caller','score',55);
You just got a free pass. Congrats!
|
2 | Pass |
%%
tic
assert(isequal(primes_faster_large(1),primes(1)))
assert(isequal(primes_faster_large(2),primes(2)))
for i=1:10
n=randi(2000,1);
assert(isequal(primes_faster_large(n),primes(n)))
end
toc
You just got a free pass. Congrats!
|
3 | Pass |
%%
tic
ta=clock;
p = primes_faster_large(2^30);
t1=etime(clock,ta); % time in sec
fprintf('P 2^30 %12i %10.3f\n',length(p),t1)
assert(isequal(length(p),54400028))
assert(all(diff(p)>0))
%assert(isequal(size(unique(p),2),54400028))
ptr=randi(7603553,1,10); % small to avoid timeout
pchk=p(ptr);
assert(all(isprime(pchk)))
feval( @assignin,'caller','score',floor(min(55,t1)) );
toc
You just got a free pass. Congrats!
|
732 Solvers
1159 Solvers
50 Solvers
Back to basics 18 - justification
176 Solvers
Matrix with different incremental runs
249 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!