Observations on coding and software engineering.
Afternoon, Andy.Afraid I don't like this: I think you're checking twice whether the number is even or not, and you test a whole load of unnecessary divisors.Wouldn't for (long i=3; i<=maxCheck; i+=2) be an improvement? But I'm sure we can do better still.
Hi AlanThat's a lot better! I will update the post to reflect your proposed changes.I came up with this while I was working on a couple of Project Euler problems so didn't bother to optimise too much as the data sets aren't too big.
Post a Comment