• fibojoly
    link
    fedilink
    arrow-up
    4
    ·
    11 months ago

    Better. Return true if the number is in a stored list of known primes, otherwise return false right away. But then, start a separate thread with an actual verification algorithm. When the verification is done, if it was actually a prime number, you just crash the program with a WasActuallyPrime exception.