Parallel prime factorization
<p>Does anyone have any idea what's the approach for <strong>parallel</strong> prime factorization algorithm ?</p>

<p>I can't figure out at which stage of the algorithm I should divide it into threads ..
How can I think about Prime factorization in a parallel way ? </p>

<p>consider the following one thread code: </p>

<pre><code>    public static void  primeFactorization(ArrayList&lt;Integer&gt; factors, int num){
        //factors is an array to save the factorization elements
        //num is the number to be factorized 
        int limit = num/2+1;

        if(isPrime(num))
            factors.add(num);

        else{
            while(num%2==0){
                factors.add(2);
                num=num/2;
            }

           for (int i=3; i&lt;limit; i+=2){
               while (isPrime(i) &amp;&amp; num%i==0){
                   factors.add(i);
                    num = num/i;
               }
           }
       }
    }

    private static boolean isPrime(int x) {
          int top = (int)Math.sqrt(x);
          for (int i = 2; i &lt;= top; i++)
             if ( x % i == 0 )
                return false;
          return true;
    }
</code></pre>
