You are viewing a single comment's thread. Return to all comments →
def get_primes(n): a = [True] * n for i in range(3, int(n**0.5)+1, 2): if a[i]: a[i**2::i*2] = [False] * int(((n-i**2-1)/(i*2)+1)) return [2] + [i for i in range(3, n, 2) if a[i]] def waiter(number, q): result, primes = [], get_primes(9734) for i in range(q + 1): b = number if i == q else [number.pop(j) for j in range(len(number) - 1, -1, -1) if number[j] % primes[i] == 0] result += b if i % 2 else b[::-1] return result
Seems like cookies are disabled on this browser, please enable them to open this website
Waiter
You are viewing a single comment's thread. Return to all comments →