Find the sum of all prime numbers between 70 and 100. How would I do this quickly? It was on my region's academic team test and it's 50 min/50 question and I can't spend all that time guessing and checking.
Prime numbers are slippery animals and there is no easy way to do this other than to write them all down and add them up. The good news is, there aren't very many of them.
what about a hard, efficient way?
No, that's the thing. There isn't anything efficient here.
Shucks.
I have a program on my nspire that will give them to me :)
That sounds amazing. Does it guess and check or use a formula?
I'm sure it has some lind of fancy algorithm the sum of the primes between 70 and 10000 is apperently 5735828 ;)
* some kind of...
But here, just do it by hand. There's only six primes between 70 and 100.
Will you do between 70 and 100?
As James has pointed out...there are only 6 of them...find them...add them up
and to check which ones are prime, remember to check whether an integer n is prime, you only need to check if it has divisors up to \( \sqrt{n} \). For instance: Is 71 prime? Well \( \sqrt{71} < 9 \). So - is 2 a divisor? no - 3? no, because sum of digits isn't a divisor of 3 - 4? Don't need to check because 4 isn't prime - 5? No, because the number doesn't end in 0 or 5 - 6? Not prime - 7? No, because 71 = 70 + 1 - 8? Not prime Hence, 71 is prime.
That's really helpful James, thanks
My own algorithm isn't exactly this strict. I throw out a lot of numbers before I start. For example, all even numbers and other multiples of 5.
As do i
But then I run these sorts of tests on what's left. For instance, in my 'first pass' list I had 91. But then I realized 91 = 70 + 21, which is clearly divisible by 7.
Okay. Thanks james. I guess I'll just have to be quick. I have a math competition on saturday and I'm pretty nervous, hopefully this comes in handy
Join our real-time social learning platform and learn together with your friends!