What's wrong in my code (Farmer Feb | POTATOES | PYTHON)

import math
def makePrime(n):

while True:
    
    if n % 2 == 0 or n <= 1:
        n += 1
        continue

    sqr = int(math.sqrt(n)) + 1

    for divisor in range(3, sqr, 2):
        if n % divisor == 0:
            n += 1
            continue
    print(n - totalPlanted)
    break

#Driver Code
for i in range(int(input())):
field_1,field_2 = map(int,input().split())
totalPlanted = field_1 + field_2
luckyNo = totalPlanted + 1
makePrime(luckyNo)

link to problem : https://www.codechef.com/problems/POTATOES

def prime(n):
    if n == 1:
        return False
    else:
        for j in range(2, int(n**0.5) + 1):
            if n % j == 0:
                return False
        else:
            return True

for _ in range(int(input())):
    a,b = map(int, input().strip().split())
    n = a + b
    while(not prime(n+1)):
        n += 1
    print((n - (a + b)) + 1)

here is my approach^^^