<reponame>micahpp/projecteuler
from projecteuler import util


def solution():
    """
    The prime factors of 13195 are 5, 7, 13 and 29.
    What is the largest prime factor of the number 600851475143 ?
    """

    i, n = 2, 600851475143
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
    return n


if __name__ == '__main__':
    assert str(solution()) == util.get_answer(3)

from projecteuler import util


def solution():
    """
    The prime factors of 13195 are 5, 7, 13 and 29.
    What is the largest prime factor of the number 600851475143 ?
    """

    i, n = 2, 600851475143
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
    return n


if __name__ == '__main__':
    assert str(solution()) == util.get_answer(3)
The prime factors of 13195 are 5, 7, 13 and 29.     What is the largest prime factor of the number 600851475143 ?