Cody

# Problem 1763. Primes for Large N: 2^30, System Memory Limit

Solution 1616166

Submitted on 25 Aug 2018
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   Fail
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

Undefined function 'primes_faster_large' for input arguments of type 'double'. Error in Test1 (line 2) assert(isequal(primes_faster_large(1),primes(1)))

2   Fail
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=double(p(ptr)); assert(all(isprime(pchk))) feval( @assignin,'caller','score',floor(min(55,t1)) ); toc

Undefined function 'primes_faster_large' for input arguments of type 'double'. Error in Test2 (line 3) p = primes_faster_large(2^30);

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!