Python3: NextPrime

Kata

Get the next prime number!

You will get a numbern (>= 0) and your task is to find the next prime number.

Make sure to optimize your code: there will numbers tested up to about 1012

Examples

5  ==> 7
12 ==> 13

My Solution

def next_prime(n):
    while(True):
        n+=1
        if is_prime(n):
            return n

def is_prime(n):
    if n == 1:
        return False
    for i in range(2,n):
        if n%i==0:
            return False
    return True

print(next_prime(0))
print(next_prime(181))
print(next_prime(911))