Mar-30-2018, 06:30 PM
Two clues for speeding up the algorithm:
a. You can increment by 2 each time, since we know that even numbers can't be prime.
b. the algorithm does not have to increment up to the number, since we also know that the largest prime can't be more than the square root of the number.
Lewis
a. You can increment by 2 each time, since we know that even numbers can't be prime.
b. the algorithm does not have to increment up to the number, since we also know that the largest prime can't be more than the square root of the number.
Lewis
To paraphrase: 'Throw out your dead' code. https://www.youtube.com/watch?v=grbSQ6O6kbs Forward to 1:00