This commit is contained in:
Violet.Lee 2019-09-24 00:38:09 +09:00 committed by GitHub
parent 4d654318cc
commit ff75cafdc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,4 +26,4 @@ for (let i = 2; i <= n; i++) { // for each i...
}
```
There's a lot of space to opimize it. For instance, we could look for the divisors from `2` to square root of `i`. But anyway, if we want to be really efficient for large intervals, we need to change the approach and rely on advanced maths and complex algorithms like [Quadratic sieve](https://en.wikipedia.org/wiki/Quadratic_sieve), [General number field sieve](https://en.wikipedia.org/wiki/General_number_field_sieve) etc.
There's a lot of space to optimize it. For instance, we could look for the divisors from `2` to square root of `i`. But anyway, if we want to be really efficient for large intervals, we need to change the approach and rely on advanced maths and complex algorithms like [Quadratic sieve](https://en.wikipedia.org/wiki/Quadratic_sieve), [General number field sieve](https://en.wikipedia.org/wiki/General_number_field_sieve) etc.