Closed MaximSmolskiy closed 3 years ago
Sieve of Eratosthenes is quite efficient nearly linear algorithm. But current implementation is naive quadratic brute force.
Before:
>> tic; sieveER(100); toc; Elapsed time is 0.0519161 seconds. >> tic; sieveER(1000); toc; Elapsed time is 5.05789 seconds.
After:
>> tic; sieveER(100); toc; Elapsed time is 0.00150514 seconds. >> tic; sieveER(1000); toc; Elapsed time is 0.00985217 seconds.
Thanks!
Sieve of Eratosthenes is quite efficient nearly linear algorithm. But current implementation is naive quadratic brute force.
Before:
After: