+ 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]

18th Apr 2018, 6:36 AM
VcC
VcC - avatar
3 Answers
18th Apr 2018, 6:36 AM
VcC
VcC - avatar
0
Fast prime is function f hereafter https://code.sololearn.com/cM8lUVSBV0PS/?ref=app
18th Apr 2018, 6:36 AM
VcC
VcC - avatar
18th Apr 2018, 6:41 AM
VcC
VcC - avatar