Search code examples
pythonprime-factoringlargenumberfactorization

Prime factors for a large number (150-bit number)


I have a really large number 510143758735509025530880200653196460532653147 from which I want to obtain its prime factors (or at least the two biggest factors) in python. I have tried with several codes but they run for ages and they don't finish. So I'm asking, is there any fast way or at least a way to compute the prime factors of a number this big?

PS: for example, one of the codes I used.

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

Solution

  • I used PariDroid on my cell phone; it completed the factorization in an instantL

    factor(510143758735509025530880200653196460532653147) =
    19704762736204164635843 * 25889363174021185185929