Check Out My YouTube Channel
Check Out More Algorithms like this at FreeCodeCamp
Sum all the prime numbers up to and including the provided number.
A prime number is defined as a number greater than one and having only two divisors, one and itself. For example, 2 is a prime number because it's only divisible by one and two.
The provided number may not be a prime.
Example
- sumAllPrimes(10) should return 17
- sumAllPrimes(977) should return 73156
Hints
- push()
- reduce()