News for hackers. Stuff that matters.
Re:Is This Prime? by W0lf on Friday July 16, 2021 @09:52AM (#27856221)
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)]
Re:Is This Prime? by PirateAvogadro on Friday July 16, 2021 @10:49AM (#27856806)
You 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))