prime.cc
/* True iff N is prime.  */
True iff N is prime.
True iff N is prime .
static bool
prime_p (int n)
{
  if (n <= 3)
    return n > 1;
  else if ((n % 2) == 0 || (n % 3) == 0)
    return false;
  int i = 5;
  while (i * i <= n)
    {
      if ((n % i) == 0 || n % (i + 2) == 0)
	return false;
      i += 6;
    }
  return true;
}
static bool prime_p ( int n ) { if ( n <= 3 ) return n > 1 ; else if ( ( n % 2 ) == 0 || ( n % 3 ) == 0 ) return false ; int i = 5 ; while ( i * i <= n ) { if ( ( n % i ) == 0 || n % ( i + 2 ) == 0 ) return false ; i += 6 ; } return true ; }
True iff N is prime.
True iff N is prime .