Impossible sum in test

Tell us what’s happening:
1+2+3+5+7 = 18
The test says its sum should be 17 with an input of 10 but that is mathematically impossible.

Your code so far

function sumPrimes(num) {
let pSum = 0;

function pTest(test){
  let p = true;
  for(let i = 2; i < test; i++){
    if((test%i) === 0){     
      return false;
    //console.log(`test%i:${test%i}, p: ${p}, test:${test}`);   
  return p;

for(let j = 0; j <= num; j++){
    pSum += j;
  //console.log(`pSum: ${pSum}, j: ${j}`);

return pSum;


Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0.

Challenge: Sum All Primes

Link to the challenge:

1 is not a prime number

1 is not a prime number.

OK thanks, I always thought it was since it was only divisible by itself.

From the challenge description

A prime number is a whole number greater than 1 with exactly two divisors: 1 and itself.

It’s a common misconception that 1 is prime.

In case you’re curious, 1 isn’t prime because prime numbers are positive integers that have exactly 2 positive divisors.

1 Like