You can speed up the processing by using a more efficient algorithm like the Sieve of Eratosthenes to generate primes up to the kth prime. Also, checking divisibility only up to the square root of a number can improve performance. Consider optimizing your loop logic to avoid redundant checks.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.