These are chat archives for camperbot/bonfire-sum-all-primes

29th
Aug 2015
Alyse Skinner
@skinner-l-a
Aug 29 2015 20:15
hint
CamperBot
@camperbot
Aug 29 2015 20:15

hint [1/8]

## :construction: After this are possible spoiler hints.

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Alyse Skinner
@skinner-l-a
Aug 29 2015 20:15
hint
CamperBot
@camperbot
Aug 29 2015 20:15

hint [2/8]

# Author

@Rafase282 submitted by Rafase282 | https://github.com/Rafase282

My Original Wiki

Details

  • Difficulty: 2/5

Sum all the prime numbers up to and including the provided number.

A prime number is defined as having only two divisors, 1 and itself. For example, 2 is a prime number because it's only divisible by 1 and 2. 1 isn't a prime number, because it's only divisible by itself.

The provided number may not be a prime.

Remember to use RSAP if you get stuck. Try to pair program. Write your own code.

Useful Links

Problem Script:

function sumPrimes(num) {
  return num;
}

sumPrimes(10);

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Alyse Skinner
@skinner-l-a
Aug 29 2015 20:15
hint
CamperBot
@camperbot
Aug 29 2015 20:15

hint [3/8]

Explanation:

The explanation for this problem is very simple. You will generate a list of prime numbers up to the number you are given as a parameter. Then you need to add them all up and return that value. The tricky part is on generating the list of prime numbers. I suggest you find a code or a good math algorithm that you can turn into code.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Alyse Skinner
@skinner-l-a
Aug 29 2015 20:16
hint
CamperBot
@camperbot
Aug 29 2015 20:16

hint [4/8]

Hint: 1

Generate a list of all the numbers up to and including the one you got as a parameter. This will be needed to determine which numbers are prime or not.

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Alyse Skinner
@skinner-l-a
Aug 29 2015 20:16
hint
CamperBot
@camperbot
Aug 29 2015 20:16

hint [5/8]

Hint: 2

Check this link if you prefer to find a solution for finding primes, or try learning and implementing your own Sieve of Eratosthenes

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Alyse Skinner
@skinner-l-a
Aug 29 2015 20:16
hint
CamperBot
@camperbot
Aug 29 2015 20:16

hint [6/8]

Hint: 3

This problem is hard if you have to create your own code to check for primes, so don't feel bad if you had to use someone's code for that bit. Either way, you are most likely using array, so once you generate an array of primes, then just add them all up and return the number you get.

type hint for next hint :pencil: [Contribute at the FCC Wiki]