Repository navigation
P2
Directory actions
More options
Directory actions
More options
P2
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
### Python Challenge 2: Find sum of all the prime numbers under 1000 ###
Hint: To test if N is a prime number, just divide N by all of the
primes less than the square root of N. (why?)
For example, to test if 211 is prime, we just divide 211 by 2, 3, 5, 7, 11, and 13.
(because math.sqrt(211) = 14.5258390463)
Hint: To use math.sqrt function, we will need to import the math module first.
import math
Phase 1. Find sum of all the prime numbers under 1000
Phase 2. Find sum of all the prime numbers under 2000000