task_id
stringlengths
36
40
entry_point
stringlengths
1
30
prompt
stringlengths
116
1.98k
suffix
stringlengths
0
837
canonical_solution
stringlengths
6
859
test
stringlengths
117
1.8k
MultiLineInfilling/HumanEval/37/L2_L7
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2]
return ans
evens.sort() ans = [] for e, o in zip(evens, odds): ans.extend([e, o]) if len(evens) > len(odds): ans.append(evens[-1])
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L2_L8
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2]
evens.sort() ans = [] for e, o in zip(evens, odds): ans.extend([e, o]) if len(evens) > len(odds): ans.append(evens[-1]) return ans
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L3_L3
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort()
for e, o in zip(evens, odds): ans.extend([e, o]) if len(evens) > len(odds): ans.append(evens[-1]) return ans
ans = []
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L3_L4
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort()
ans.extend([e, o]) if len(evens) > len(odds): ans.append(evens[-1]) return ans
ans = [] for e, o in zip(evens, odds):
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L3_L5
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort()
if len(evens) > len(odds): ans.append(evens[-1]) return ans
ans = [] for e, o in zip(evens, odds): ans.extend([e, o])
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L3_L6
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort()
ans.append(evens[-1]) return ans
ans = [] for e, o in zip(evens, odds): ans.extend([e, o]) if len(evens) > len(odds):
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L3_L7
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort()
return ans
ans = [] for e, o in zip(evens, odds): ans.extend([e, o]) if len(evens) > len(odds): ans.append(evens[-1])
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L3_L8
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort()
ans = [] for e, o in zip(evens, odds): ans.extend([e, o]) if len(evens) > len(odds): ans.append(evens[-1]) return ans
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L4_L4
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort() ans = []
ans.extend([e, o]) if len(evens) > len(odds): ans.append(evens[-1]) return ans
for e, o in zip(evens, odds):
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L4_L5
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort() ans = []
if len(evens) > len(odds): ans.append(evens[-1]) return ans
for e, o in zip(evens, odds): ans.extend([e, o])
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L4_L6
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort() ans = []
ans.append(evens[-1]) return ans
for e, o in zip(evens, odds): ans.extend([e, o]) if len(evens) > len(odds):
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L4_L7
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort() ans = []
return ans
for e, o in zip(evens, odds): ans.extend([e, o]) if len(evens) > len(odds): ans.append(evens[-1])
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L4_L8
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort() ans = []
for e, o in zip(evens, odds): ans.extend([e, o]) if len(evens) > len(odds): ans.append(evens[-1]) return ans
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L5_L5
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort() ans = [] for e, o in zip(evens, odds):
if len(evens) > len(odds): ans.append(evens[-1]) return ans
ans.extend([e, o])
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L5_L6
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort() ans = [] for e, o in zip(evens, odds):
ans.append(evens[-1]) return ans
ans.extend([e, o]) if len(evens) > len(odds):
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L5_L7
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort() ans = [] for e, o in zip(evens, odds):
return ans
ans.extend([e, o]) if len(evens) > len(odds): ans.append(evens[-1])
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L5_L8
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort() ans = [] for e, o in zip(evens, odds):
ans.extend([e, o]) if len(evens) > len(odds): ans.append(evens[-1]) return ans
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L6_L6
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort() ans = [] for e, o in zip(evens, odds): ans.extend([e, o])
ans.append(evens[-1]) return ans
if len(evens) > len(odds):
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L6_L7
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort() ans = [] for e, o in zip(evens, odds): ans.extend([e, o])
return ans
if len(evens) > len(odds): ans.append(evens[-1])
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L6_L8
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort() ans = [] for e, o in zip(evens, odds): ans.extend([e, o])
if len(evens) > len(odds): ans.append(evens[-1]) return ans
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L7_L7
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort() ans = [] for e, o in zip(evens, odds): ans.extend([e, o]) if len(evens) > len(odds):
return ans
ans.append(evens[-1])
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L7_L8
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort() ans = [] for e, o in zip(evens, odds): ans.extend([e, o]) if len(evens) > len(odds):
ans.append(evens[-1]) return ans
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/37/L8_L8
sort_even
def sort_even(l: list): """This function takes a list l and returns a list l' such that l' is identical to l in the odd indicies, while its values at the even indicies are equal to the values of the even indicies of l, but sorted. >>> sort_even([1, 2, 3]) [1, 2, 3] >>> sort_even([5, 6, 3, 4]) [3, 6, 5, 4] """ evens = l[::2] odds = l[1::2] evens.sort() ans = [] for e, o in zip(evens, odds): ans.extend([e, o]) if len(evens) > len(odds): ans.append(evens[-1])
return ans
METADATA = {} def check(candidate): assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10])
MultiLineInfilling/HumanEval/38/L0_L0
decode_cyclic
def encode_cyclic(s: str): """ returns encoded string by cycling groups of three characters. """ # split string to groups. Each of length 3. groups = [s[(3 * i):min((3 * i + 3), len(s))] for i in range((len(s) + 2) // 3)] # cycle elements in each group. Unless group has fewer elements than 3. groups = [(group[1:] + group[0]) if len(group) == 3 else group for group in groups] return "".join(groups) def decode_cyclic(s: str): """ takes as input string encoded with encode_cyclic function. Returns decoded string. """
return encode_cyclic(encode_cyclic(s))
METADATA = {} def check(candidate): from random import randint, choice import string letters = string.ascii_lowercase for _ in range(100): str = ''.join(choice(letters) for i in range(randint(10, 20))) encoded_str = encode_cyclic(str) assert candidate(encoded_str) == str
MultiLineInfilling/HumanEval/39/L0_L0
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
import math
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L0_L2
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
import math def is_prime(p):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L0_L3
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
import math def is_prime(p): if p < 2:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L0_L4
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
import math def is_prime(p): if p < 2: return False
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L0_L5
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L0_L6
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L0_L7
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L0_L8
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L0_L9
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L0_L10
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L0_L11
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2])
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L0_L12
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
n -= 1 if n == 0: return f[-1]
import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L0_L13
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
if n == 0: return f[-1]
import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L0_L14
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
return f[-1]
import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L0_L15
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """
import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L2_L2
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math
if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
def is_prime(p):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L2_L3
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math
return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
def is_prime(p): if p < 2:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L2_L4
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math
for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
def is_prime(p): if p < 2: return False
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L2_L5
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math
if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L2_L6
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math
return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L2_L7
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math
return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L2_L8
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math
f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L2_L9
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math
while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L2_L10
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math
f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L2_L11
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math
if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2])
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L2_L12
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math
n -= 1 if n == 0: return f[-1]
def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L2_L13
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math
if n == 0: return f[-1]
def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L2_L14
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math
return f[-1]
def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L2_L15
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math
def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L3_L3
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p):
return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
if p < 2:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L3_L4
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p):
for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
if p < 2: return False
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L3_L5
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p):
if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L3_L6
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p):
return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L3_L7
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p):
return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L3_L8
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p):
f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L3_L9
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p):
while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L3_L10
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p):
f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L3_L11
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p):
if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2])
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L3_L12
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p):
n -= 1 if n == 0: return f[-1]
if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L3_L13
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p):
if n == 0: return f[-1]
if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L3_L14
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p):
return f[-1]
if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L3_L15
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p):
if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L4_L4
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2:
for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return False
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L4_L5
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2:
if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L4_L6
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2:
return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L4_L7
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2:
return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L4_L8
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2:
f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L4_L9
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2:
while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L4_L10
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2:
f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L4_L11
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2:
if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2])
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L4_L12
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2:
n -= 1 if n == 0: return f[-1]
return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L4_L13
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2:
if n == 0: return f[-1]
return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L4_L14
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2:
return f[-1]
return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L4_L15
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2:
return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L5_L5
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False
if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L5_L6
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False
return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L5_L7
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False
return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L5_L8
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False
f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L5_L9
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False
while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L5_L10
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False
f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L5_L11
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False
if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2])
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L5_L12
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False
n -= 1 if n == 0: return f[-1]
for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L5_L13
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False
if n == 0: return f[-1]
for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L5_L14
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False
return f[-1]
for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L5_L15
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False
for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L6_L6
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):
return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
if p % k == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L6_L7
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):
return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
if p % k == 0: return False
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L6_L8
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):
f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
if p % k == 0: return False return True
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L6_L9
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):
while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
if p % k == 0: return False return True f = [0, 1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L6_L10
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):
f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
if p % k == 0: return False return True f = [0, 1] while True:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L6_L11
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):
if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2])
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L6_L12
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):
n -= 1 if n == 0: return f[-1]
if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L6_L13
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):
if n == 0: return f[-1]
if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L6_L14
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):
return f[-1]
if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L6_L15
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)):
if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L7_L7
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0:
return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return False
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437