You are viewing a single comment's thread. Return to all comments →
python3
def redJohn(n): ways = [0, 1, 1, 1, 2] + [0]*(n-4) for i in range(5, n+1): ways[i] += ways[i-1] + ways[i-4] return primes_below(ways[n]) def primes_below(k): count = 0 for p in range(2, k+1): is_prime = True for i in range(2, int(p**0.5)+1): if p % i ==0: is_prime = False break if is_prime: count += 1 return count
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 →
python3