Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualsooner123

Posted 19 December 2012 - 06:37 AM

Wow that runs a lot faster. Thanks

Mainly it's removing the sqrt function.

Are you sure that break; accomplishes anything? I think the "isPrime &&" part of the for loop's conditional accomplishes the same thing.

#1sooner123

Posted 19 December 2012 - 06:36 AM

Wow that runs a lot faster. Thanks

Mainly it's removing the sqrt function.

The +=2 gives a minor performance boost but I don't like hardcoding that primes>2 are odd and it only gives a 1% boost roughly. I could also boost by 2 unless boosting by 2 was divisible by 3, in which case I boost by 4, etc.

Are you sure that break; accomplishes anything? I think the "isPrime &&" part of the for loop's conditional accomplishes the same thing.

PARTNERS