Skip to content

Instantly share code, notes, and snippets.

@Megaf
Megaf / search-for-primes.py
Last active February 12, 2021 00:48
multi process version of the prime number counter from https://www.youtube.com/watch?v=hGyJTcdfR1E
import multiprocessing as mp
import time
#max number to look up to
max_number = 10000
#four processes per cpu
num_processes = mp.cpu_count() * 1
def chunks(seq, chunks):