title: Count the number of proper fractions
body: <p>A fraction p/q (p and q are positive integers) is proper if p/q &lt; 1. Given 3 &lt;= N &lt;= 50 000 000, write a program to count the number of proper fractions p/q such that p + q = n, and p, q are relative primes (their greatest common divisor is 1).
  This is my code</p>
  
  <pre><code>bool prime_pairs(int x, int y) {
      int t = 0;
      while (y != 0) {
          t = y;
          y = x % y;
          x = t;
      }
      return (x == 1);
  }
  
  void proer_fractions(int n) {
      int num = n % 2 == 0 ? n / 2 - 1 : n / 2, den = 0, count = 0;
      for (; num &gt; 0; --num) {
          den = n - num;
          if (prime_pairs(num, den))
              ++count;
      }
      printf("%d", count);
  }
  </code></pre>
  
  <p>I wonder if I did it correctly. Is there anyway to speed up the algorithm? It took my laptop (i7-4700mq) 2.97 seconds to run with Release mode when N = 50 000 000.</p>
  
  <p>Thank you very much.</p>