Time Complexity: Primality

  • + 0 comments

    Find the largest int in a0, make a sieve up to the square root of that once. Then instead of testing every number less than the square root of each a0, you only are testing the primes less than the squareroot of a0 using the seive you just built. It would cut down on the the number of loops especially for larger numbers.