Problem 7

By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.

What is the 10001st prime number?

エラトステネスのふるいを普通に実装したら遅かった。高速化に手間取った。

sieve ms ns= ms++(sieve ps rs)
where (ps,qs)=span(<head ms ^2) ns
rs= [q|q<-qs,and$map ((/=).mod q) ms]
p007 = sieve [2] [3,5..] !! 10000
More Reading
Newer// Problem 6
Older// Problem 8