title: Sorting sequence based on greatest common division
body: <p>I have a question. I write this comparator:</p>
  
  <pre><code>bool cmp(int a, int b)
  {
     return __gcd(a, b) &gt; 1;
  }
  </code></pre>
  
  <p>and, for example:</p>
  
  <p>if I have these numbers:</p>
  
  <pre><code>2 5 6 7 8 12 15 19 20
  </code></pre>
  
  <p>my code outputs:</p>
  
  <pre><code>20 15 12 8 6 2 5 7 19
  </code></pre>
  
  <p>it's okay..</p>
  
  <p>but for example:</p>
  
  <pre><code>1 2 3 4 5 6 7 8 9
  </code></pre>
  
  <p>my code outputs</p>
  
  <pre><code>1 2 3 4 5 6 7 8 9
  </code></pre>
  
  <p>How can I do this?</p>
  
  <p>this sequence should be something like this:</p>
  
  <pre><code>9 6 3 (...)
  </code></pre>