sum_from_one(k): sum = 0 for i in range(1, k+1): sum += i return sum sum_list = [] for i in range(0, N): sum_list.append(sum_from_one(i)) (N=10000) -Python 2.09 s 28.3 ms Cython 6.36 ms 62.5 µs +.#(joblib) 702 ms 21 ms MacBook Pro 13!(2018" ) &4 16GB OSmacOS Mojave 10.14.1