 # Test for Sum all primes (aka sumPrime) Challenge violates own rules

The provided number may not be a prime.

977 is a prime.

How can I pass this test without violating the rules?

sumPrimes(977) should return 73156.

It just means the provided number might not be a prime (or it might be)

1 Like

Since 977 is prime, it should definitely be included in the calculation of the final sum.

1 Like

Here is a fix. Solved it. Not sure why. Youn will have to edit it a little to take it out of Android environment

```system.execute("/JavaScript/console.jsa");
var primeBox=[2,3];
//Function to test if prime. If it is, add it to the box.
function isPrime(val)
{
var trip=false;
for(var i=0;i<primeBox.length;i++){
if(Math.floor(val / primeBox[i])==(val / primeBox[i])){trip=true;}
}
if(trip==false){primeBox.push(val);}//console.print("*");
}
//Run all the numbers through isPrime()
for(var x=4;x<=1000;x++){
isPrime(x);
}
// The magic happens here.
// temp is 0, adds the value of primeBox[t] to it.
// 73156 is what FCC says should be the
// result of 977.
var temp=0;
var testamount=73156;
for(t=0;t<primeBox.length;t++){
temp+=primeBox[t];

if(temp==testamount){
console.print("*"+temp+"::"+testamount+"::"+t+"*\n");

}
}
console.print(""+temp+"::"+testamount+"::"+primeBox.length);

//Here is the weird part here is my outcome.
// At t=164 to equals 73156
// But that isn't the end it goes to 168
// At t=168 its 76127

```

I understand the subtle use of language and choice of wording.

IMO it should have read, “The provided number may or may not be a prime.”