def solve_2():
    number = 600851475143
    i = 3
    maxPrimeFactor = 1 # Btw, 1 is not prime.
    lim = number**0.5

    while i < lim:
        if not (number % i):
            if prime(i):
                maxPrimeFactor = max(maxPrimeFactor, i)

            if prime(number/i):
                maxPrimeFactor = max(maxPrimeFactor, number/i)

        i += 2

    return maxPrimeFactor
def solve_2(limit=1000000):
    primeSum = [2]
    i = 3
    while primeSum[-1] < limit:
        if prime(i):
            primeSum.append(primeSum[-1] + i)

        i += 2

    max = 0
    maxConsecutive = 0
    for i in range(len(primeSum)):
        for j in range(i, len(primeSum)):
            tmp = primeSum[j] - primeSum[i]
            d = j - i

            if d > maxConsecutive and prime(tmp):
                (max, maxConsecutive) = (tmp, d)

    return max
def solve():
    limit = 10001
    count = 1 # 2 is a prime number
    i = 1

    while count < limit:
        i += 2

        if prime(i):
            count += 1


    return i
def prop(n):
    if not prime(n):
        return False

    listN = toList(n)
    listN.sort()
    
    i = 1
    while i <= 2:
        m = n + i*3330
        
        if not prime(m):
            return False
            
        listN2 = toList(m)
        listN2.sort()
        
        if listN != listN2:
            return False
            
        i += 1
            
    return True
def solve(lim=1000000):
    old_p = 0

    p = 1
    k = 1
    while True:
        if p > lim:
            break

        if prime(k):
            old_p = p
            p *= k

        k += 1

    return old_p
def solve(limit=1000000):
    primeSum = sortedList([2])

    iterator = 3
    max = 0
    maxConsecutive = 0

    while iterator < limit:
        if prime(iterator):
            primeSum.add(primeSum[-1] + iterator)

            consecutive = sumOfPrimes(iterator, primeSum)
            if consecutive > maxConsecutive:
                (max, maxConsecutive) = (iterator, consecutive)

        iterator += 2

    return max