Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
feval(@assignin,'caller','score',30); %
|
2 | Fail |
%%
tic
assert(isequal(primes_faster(1),primes(1)))
assert(isequal(primes_faster(2),primes(2)))
for i=1:100
n=randi(2000,1);
assert(isequal(primes_faster(n),primes(n)))
end
toc
Error: Undefined function 'primes_faster' for input arguments of type 'double'.
|
3 | Fail |
%%
tic
ta=clock;
p = primes_faster(2^28);
t1=etime(clock,ta); % time in sec
fprintf('P 2^28 %12i %10.3f\n',length(p),t1)
assert(isequal(size(unique(p),2),14630843))
ptr=randi(7603553,1,10); % small to avoid timeout
pchk=double(p(ptr));
assert(all(isprime(pchk)))
feval( @assignin,'caller','score',floor(min(30,t1)) );
toc
Error: Undefined function 'primes_faster' for input arguments of type 'double'.
|
17214 Solvers
5832 Solvers
Create a cell array out of a struct
508 Solvers
Arrange Vector in descending order
4076 Solvers
Sum of diagonal of a square matrix
1327 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!