From the FreeCodeCamp intermediate algorithms here: A prime number is a whole number greater than 1 with exactly two divisors: 1 and itself. For example, 2 is a prime number because it is only divisible by 1 and 2. In contrast, 4 is not prime since it is divisible by 1, 2 and 4. Rewrite sumPrimes so it returnsContinue reading “Sum All Primes”
Tag Archives: array
Sum All Odd Fibonacci Numbers
From the FreeCodeCamp intermediate algorithms here: Given a positive integer num, return the sum of all odd Fibonacci numbers that are less than or equal to num. The first two numbers in the Fibonacci sequence are 1 and 1. Every additional number in the sequence is the sum of the two previous numbers. The first six numbersContinue reading “Sum All Odd Fibonacci Numbers”