@hbar1st/

MedicalNativeAutomaticparallelization

Nodejs

No description

fork
loading
Files
  • index.js
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function isPrime(num1){
	var remainder = [];
	var squareroot = Math.floor(Math.sqrt(num1))
	for(let i=2;i<squareroot;i++){
		remainder.push(num1%i);
	  console.log("push to remainders array: "+(num1%i));
}
  	if(remainder.includes(0)){
		return false;
	}
	return true;
	}
function sumPrimes(num) {
  var newArr =[]
  for(let j=1;j<num;j++){
    if(isPrime(j)){
      console.log(j+" is a prime");
      newArr.push(j);
    }
  }

  return newArr.reduce(((a,b) => a+b),0);
}

sumPrimes(10);
node v10.16.0