title: Checking for a Prime Number with JavaScript
body: <p>I'm doing the 3rd project euler question right now. So far I've figured out how to solve the problem which is finding the largest prime factor of 600851475143.</p>
  
  <p>I've wrote a small bit of code that can place all the prime factors of a number into an array. The problem I'm having is the number may be too large to compute. I've used other large numbers (not as large as this one) and they've worked fine but this one just freezes up the page like it's in an endless loop. Here's the code:  </p>
  
  <pre><code>var primes = [];
  function factor (largestNumber) {
      var a = largestNumber;
      var b = 2; 
      while (b &lt; largestNumber) {
          if (a % b == 0) {
              a /= b;
              primes.push(b);
              b = 2;
  
          } else {
              b++;
          }
      }
  }
  
  factor(600851475143);
  console.log(primes);
  </code></pre>