# Python program for OEIS A274649 # by Michael S. Branicky, May 03 2021 #(Python) # alternate that searches in parallel to a limit from sympy import primerange def aupton(terms, limit): psum, nset, alst = 2, set(range(terms+1)), [0]*(terms+1) for p in primerange(3, limit+1): newfound = set() for n in nset: if (n + psum)%p == 0: alst[n] = p newfound.add(n) nset -= newfound if len(newfound) > 0: print(p, len(nset), sorted(nset), alst) psum += p if len(nset) == 0: break return alst print(aupton(11, 30915397)) # ~~~~