Prime Factorization

Wrote a code with two functions (one good & other not so good) to find
the prime factors of a number.
Tried it with some numbers. With
111111111111111111111111111111111111111111111111111111111111111111111111111111
it struggles for over half an hour to give
3*7*11*13*13*37*53*79*157*859*6397*216451*265371653.. (there are more
factors left).