If I prompt it, it actually comes up with a decent function:
def is_prime(element):
"""Returns whether a number is prime."""
if element < 2:
return False
if element == 2:
return True
if element % 2 == 0:
return False
for i in range(3, int(math.sqrt(element)) + 1, 2):
if element % i == 0:
return False
return True
Of course, if you ask it to keep generating past that there's the usual slow descent into madness.