def prime(n, primes):
    """Return True if a given n is a prime number, else False."""
    if n > 5 and n % 10 == 5:
        return False
    for p in primes:
        if n % p == 0:
            return False
    return True