project_euler_problems/summation of primes/solution.c
int isPrime(int nb) {
  int root;

  if (nb == 1) {
    return FALSE;
  } else if (nb == 2 || nb == 3) {
    return TRUE;
  } else if (isEven(nb)) {
    return FALSE;
  }
	
  // square root of `nb` rounded to the greatest integer `root` so that:
	// root * root <= nb
  root = ceil(sqrt(nb));

  for (int f = 3; f <= root; f += 2) {
    if (nb % f == 0) {
      return FALSE;
    }
  }
  return TRUE;
}
/*
 ** A prime number is a number that can only be divisible by 1 or itself
 ** Facts about prime numbers:
 **   - 1 is not a prime.
 **   - All primes except 2 are odd.
 */
A prime number is a number that can only be divisible by 1 or itself
Facts about prime numbers:
- 1 is not a prime.
- All primes except 2 are odd.
A prime number is a number that can only be divisible by 1 or itself Facts about prime numbers : - 1 is not a prime . - All primes except 2 are odd .
int isPrime(int nb) {
  int root;
  if (nb == 1) {
    return FALSE;
  } else if (nb == 2 || nb == 3) {
    return TRUE;
  } else if (isEven(nb)) {
    return FALSE;
  }
  root = ceil(sqrt(nb));
  for (int f = 3; f <= root; f += 2) {
    if (nb % f == 0) {
      return FALSE;
    }
  }
  return TRUE;
}
int isPrime ( int nb ) { int root ; if ( nb == 1 ) { return FALSE ; } else if ( nb == 2 || nb == 3 ) { return TRUE ; } else if ( isEven ( nb ) ) { return FALSE ; } root = ceil ( sqrt ( nb ) ) ; for ( int f = 3 ; f <= root ; f += 2 ) { if ( nb % f == 0 ) { return FALSE ; } } return TRUE ; }
A prime number is a number that can only be divisible by 1 or itself
 Facts about prime numbers:
   - 1 is not a prime.
A prime number is a number that can only be divisible by 1 or itself Facts about prime numbers : - 1 is not a prime .
// square root of `nb` rounded to the greatest integer `root` so that: // root * root <= nb