title: Remove all composite numbers from an array
body: <p>I have a sorted array <code>a</code> having size 2*10<sup>5</sup> and 1&le;A[i]&le;10<sup>10</sup> containing both prime and composite numbers.  The numbers are generated as indicated below:</p>
  
  <pre><code>a[1] = 1
  for i &gt; 1
      a[i] = a[i-1]+(i/2)
  </code></pre>
  
  <p>How can I efficiently remove the composite numbers from the array?  One solution is to check the primality of each element with Rabin-Miller.  Is there a more efficient solution?</p>