what is the algorithm behind the factor command in linux?
Here's an example of one version of the source for GNU factor:
http://www.futuretg.com/FTHumanEvolutionCourse/Source/factor.c
It includes routines for both trial division and Pollard's rho. Looks to me on a quick scan as if it uses trial division to find some small factors (up to about lg(n)^2
, which is about 4000 in this case), then Pollard if what's left isn't probably-prime. In this case that's 205432623008947
if I'm right about the 4000, i.e. 35129 * 5847949643
.
The second-largest prime factor in your example is 35129
, and the square root of the largest is around 76471
. So trial division alone would be fast, since it only has to try about 25 thousand candidates.
Gnu coreutils manual informs that Pollard's rho algorithm is being used.
http://www.gnu.org/software/coreutils/manual/html_node/factor-invocation.html