Project Euler 50: Consecutive prime sum I just finished solving Project Euler's 50th problem, but it's awfully slow. I'd like to hear your thoughts on my code's efficiency and practices.
Problem Statement
The prime 41, can be written as the sum of six consecutive primes:
\$41 = 2 + 3 + 5 + 7 + 11 + 13\$
This is the longest sum of consecutive primes that adds to a prime below one-hundred.
The longest sum of consecutive primes below one-thousand that adds to a prime, contains 21 terms, and is equal to 953.
Which prime, below one-million, can be written as the sum of the most consecutive primes?
Code

let primeNumbers = [];

function isPrime(number) { // checks whether number is prime or not
    for(let i = 2; i &lt;= number / 2; i++) { // stops checking at 1/2 of number
        if (number % i === 0) return false;
    }
    return true;
}

function storePrimes(count) {
    for(let i = 2; i &lt; count; i++) { // starts at 2
        if (isPrime(i)) {
            primeNumbers.push(i);
        }
    }
}

function findLargestSum() {
    let termsCount = 0;
    let sumOfTerms = 0;

    primeNumbers.forEach(currentSum =&gt; { // keeps track of possible sum
        primeNumbers.forEach((startNumber, startIndex) =&gt; { // keeps track of start index
            let consecutiveCount = 0;
            let consecutiveSum = 0;
            primeNumbers.forEach((prime, primeIndex) =&gt; { // iterates through primes
                if (primeIndex &gt;= startIndex) { // applies start index
                    consecutiveCount++;
                    consecutiveSum += prime;
                    if (consecutiveCount &gt; termsCount &amp;&amp; consecutiveSum === currentSum) {
                        termsCount = consecutiveCount;
                        sumOfTerms = consecutiveSum;
                    }
                }
            })
        })
    })

    return {largestSum: sumOfTerms, termsCount: termsCount};
}

function findPrimes(count) {
    storePrimes(count)
    let results = findLargestSum();
    console.log(&quot;Largest sum'o'primes of prime consecutives under &quot; + count + &quot; is: &quot; + results.largestSum + &quot; with &quot; + results.termsCount + &quot; terms.&quot;);
}

findPrimes(1000000);
Improvement in function isprime:
for(let i = 2; i &lt;= number / 2; i++)

can be
for(let i = 2; i &lt;= Math.round(Math.sqrt(number)) + 1 ; i++)

Otherwise, the best easy to understand approach(in accordance to my knowledge) is to use the Sieve of Eratosthenes. Your problem can be a subset of the following problem Sieve of Eratosthenes JavaScript implementation - performance very slow over a certain number. Credits of the code below goes to the owner of this post.
function getPrimesUnder(number) {
  var start = new Date().getTime();

  var numbers = [2];
  var sqNum = Math.sqrt(number);
  var i, x;
  for (i = 3; i &lt; number; i = i + 2) {
    numbers.push(i);
  }
  for (x = 0; numbers[x] &lt; sqNum; x++) {
    for (i = 0; i &lt; numbers.length ; i++){
       if (numbers[i] &gt; numbers[x]) {
        if(numbers[i] % numbers[x] === 0){
          numbers.splice(i, 1)
        }
      }
    }
  }
  var end = new Date().getTime();
  var time = end - start;
  alert('Execution time: ' + time/1000 + ' seconds');
  return numbers;

} 

There is something much more efficient (Which is the fastest algorithm to find prime numbers?) known as Sieve of Atkin. You can do more research on it.