Quote:Code:#!/usr/bin/env python
def isprime(n):
if n > 10:
for x in range(2, 11): if n%x == 0: return False
else: return True
if n <= 10: return False if n in [1, 4, 6, 8, 9, 10] else True
Defeated by:
Code:
if isprime(x) and x > 11: isprime(x**x)
For example:
Code:
if isprime(13) and x > 11: # Will return true, as 13 is a prime and is larger than 10.
isprime(13**13) # As 13 is not in the check list, this number will be found to be a prime, even though it clearly is not.