title: Faster way to check if a number is a prime?
body: <p>I got this code that checks if a number is a prime:</p>
  
  <pre><code>public static bool isPrime(int num)
  {
      if (num == 1) return false;
      if (num == 2) return true;
  
      int newnum = Math.Floor(Math.Sqrt(num));
  
      for (int i = 2; i &lt;= newnum; i++) 
          if (num % i == 0) return false;
  
      return true;
  }
  </code></pre>
  
  <p>Is there any better and faster way to check if a number is a prime?</p>