title: What is the best, most performant algorithm to find all primes up to a given number?
body: <p>I'm currently having this method which works fine:</p>
  
  <pre><code> private static List&lt;long&gt; GetPrimeNumbers(long number)
          {
              var result = new List&lt;long&gt;();
              for (var i = 0; i &lt;= number; i++)
              {
                  var isPrime = true;
                  for (var j = 2; j &lt; i; j++) 
                  {
                      if (i % j == 0) 
                      {
                          isPrime = false;
                          break;
                      }
                  }
                  if (isPrime)
                  {
                      result.Add(i);
                  }
              }
              return result;
          }
  </code></pre>
  
  <p>Is the above the best algorithm possible?</p>
  
  <p>It's really slow when the number is above 100000.</p>
  
  <p>I mean, what'd be the best, most performant algorithm to find the prime numbers less than or equal to a given number?</p>