2. Coding: Find the n-th prime number
Anonimo
Use primality algorithm for each integer k<=n, test if the number k is evenly divisible by 2 and 3 and then check for numbers of form 6k+-1<=sqrt(k). Complexity for each k: sqrt(k)/3 Total complexity: Sum over all k ~ O(nsqrt(n))