We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #7: 10001st prime
Project Euler #7: 10001st prime
Sort by
recency
|
274 Discussions
|
Please Login in order to post a comment
python version of the answer
def prime_s(num):
def nth_prime(n, precomputed_primes): import math if n <= len(precomputed_primes): return precomputed_primes[n-1] else: limit = int(n*math.log(n)*1.5) if n > 5 else 15
precomputed_primes = prime_s(10**6) t = int(input().strip()) for a0 in range(t): n = int(input().strip())
Python 3:
include
include
include
using namespace std;
vector sieve_of_eratosthenes(int max_n){ vector is_prime(max_n+1, true); vectorprimes;
}
int nth_prime(int n, const vector&primes){ return primes[n-1]; }
int main(){ int T; cin >> T;
}
C solution using precomputed bit array prime table.
https://github.com/Achintha444/projecteuler-_javascript/blob/main/7-euler007.js
Answer in JS