Got it to 17s, from 34s using the lazy iterators, was still using 2..(n/2) for checking primes.
Got it down to 0.9s by changing the prime check to 2..(sqrt(n)+1)

The iterator for checking prime uses any(|i| n % i == 0) instead of all(|i| !n % i == 0), so that it may short-circuit when any case returns true. Similar to using a loop with break condition.

## re: Project Euler #7 - 10001st prime VIEW POST

FULL DISCUSSIONRust Solution: Playground

Got it to 17s, from 34s using the lazy iterators, was still using

`2..(n/2)`

for checking primes.Got it down to 0.9s by changing the prime check to

`2..(sqrt(n)+1)`

The iterator for checking prime uses

`any(|i| n % i == 0)`

instead of`all(|i| !n % i == 0)`

, so that it may short-circuit when any case returns true. Similar to using a loop with break condition.Still is a brute force technique.