+ 1
[ASSIGNMENT] : make the most efficient prime testing code
In sololearn challenges we have seen several prime testing methods: "naive" ( test if p is even, and all the odd divisors until sqrt(p)), "fast" (using Miller Rabin, see example hereafter), sieve (google it or see example hereafter)... Your challenge is to make the fastest prime testing software which leverage the correct method depending on the size of the numbers in the two following cases prime(p) [returns true is p is prime] primes(a,b) [returns the list of primes between a and b]
3 Answers
0
Fast prime is function f hereafter
https://code.sololearn.com/cM8lUVSBV0PS/?ref=app
0
Naive prime
https://code.sololearn.com/cnU20ZM7PqAy/?ref=app