3 ms·
I am not doing _that_ type of number crunching in my daily work, so the following check (in Python) has probably lots of potential for improvement: def is_
by W0lf 5y ago
I am not doing _that_ type of number crunching in my daily work, so the following check (in Python) has probably lots of potential for improvement:
def is_prime(n):
return not True in [n%x == 0 for x in range(2, n/2)]
- PirateAvogadro 5y agoYou don't need to test up to n/2, just floor(sqrt(n)) will do even better you only need to test the primes <= floor(sqrt(n))