pari-gp is freely available for linux, and it&#x27;s source is available if you&#x27;re interested in their implementation.<p><a href="http:&#x2F;&#x2F;pari.math.u-bordeaux.fr&#x2F;" rel="nofollow">http:&#x2F;&#x2F;pari.math.u-bordeaux.fr&#x2F;</a><p>The relevant file is<p><pre><code>  src&#x2F;basemath&#x2F;ifactor1.c</code></pre>