Problem 1763. Primes for Large N: 2^30, System Memory Limit
Solution Stats
Problem Comments
-
3 Comments
Nice problem!
I have had some problems to get trough the test suite, one of them was that my primes where in UINT32 and that failed the 'isprime' assertion.
Maybe you could change the following line
pchk=p(ptr);
to
pchk=double(p(ptr));
Double implemented in test suite. Intent is to find the primes, not to get snared by errant function limitations.
Currently the MATLAB function primes is able to solve this problem. Since systems always evolve, the problem's author will probably have to be constantly updating it. Or at least, once a year.
Solution Comments
-
1 Comment
Nice merger of primes with a customized sieving to set a new speed record on a limited memory system.
-
1 Comment
Sorry, but can't get code to run at all. So try to get some help this way...
Problem Recent Solvers16
Suggested Problems
-
Find the longest sequence of 1's in a binary sequence.
4540 Solvers
-
Increment a number, given its digits
596 Solvers
-
Arrange Vector in descending order
6543 Solvers
-
446 Solvers
-
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
330 Solvers
More from this Author255
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!