from lib_prime import prime_nth


def euler_007():
    return prime_nth(10001)


def euler_007_forum_4r0():
    """ This solution is very naiv. I only got intrigued by
    it because it looked so weird and simple in the beginning.
    Turned out it is a straight forward and naiv as it gets once
    you format the code properly and give somewhat meaningful
    variable names. """
    prime_count = 0
    divisor = 2
    prime = 2
    while prime_count != 10001:
        print(prime_count)
        divisor = 2
        while divisor <= prime:
            if prime % divisor == 0 and divisor != prime:
                divisor = prime
            elif divisor == prime:
                prime_count += 1
            divisor += 1
        prime += 1
    prime -= 1
    return prime


assert(euler_007() == 104743)
print("e007.py: {}".format(euler_007()))
