3 ms·
Firstly, lots of work has been done here. See for example http://www.worldofnumbers.com/repunits.htm http://www.worldofnumbers.com/repunits.htm (factorizations
by Someone 11y ago
Firstly, lots of work has been done here. See for example http://www.worldofnumbers.com/repunits.htm http://www.worldofnumbers.com/repunits.htm (factorizations of repunits up to 8580 digits).
I also think repunits are, in general, easier to factor because ones that do not have a prime number of digits have obvious divisors.
Certainly, rep units of up to 50 digits are factored easily (Google a bignum factorization program online, and try for yourself)
Even disregarding that, the original code computed a square root about sqrt(n) times (that's why its running time went up by a factor of 10 for every two digits added). Even without using advanced factoring algorithms, you can factor that number using, at the very most, sqrt(n) trial divisions.