You are viewing a single comment's thread. Return to all comments →

I have the least time execution dealing with prime numbers

def isprime(n): prime = [True for i in range(n + 1)] p = 2 while p * p <= n: if prime[p]: for i in range(p * 2, n + 1, p): prime[i] = False p += 1 prime_numbers = [] for p in range(2, n): if prime[p]: prime_numbers.append(p) return len(prime_numbers) def redJohn(n): m = 0 for i in range(n // 4 + 1): pl = n - (i * 3) m += int(math.factorial(pl) / (math.factorial(i) * math.factorial(pl - i))) return isprime(m+1)

Seems like cookies are disabled on this browser, please enable them to open this website

## Red John is Back

You are viewing a single comment's thread. Return to all comments →

I have the least time execution dealing with prime numbers