coprimesParallelIter[n_] := DistributeDefinitions[GCD];
ClearAll;
ParallelTable[If[GCD[i, n] == 1, i, Nothing], {i, 1, n - 1}] //
Flatten // DeleteCases[Nothing]
That function generates the list of coprimes less than n, but how can this list of coprimes be stored? When I call the function there is no return value.
n
, so maybe that's why it's failing. Also, you don't actually usecoprimesParallelIter
anywhere, so it's not clear why that is included in your sample code. Are you sure you posted what you intended to post? $\endgroup$