The goal today is to write a function that returns the sum of all prime numbers up to a limit. We will do this in two steps: first we're going to write an
isPrime function that checks wether or not a number is prime, and then the actual
Check if a number is prime
isPrime function that takes a number as parameter and returns true if this number is prime, false if it isn't.
Reminder: A prime number:
- Can only be divided by
- Is greater than
Sum all primes
sumPrimes function to sum all prime numbers up to the parameter
limit included. Copy you
isPrime function from the last assignment to make use of it here.