1
$\begingroup$

Program should return a list of all the divisors of n!-1 for n=50,51,...,59 using parallel computing.

Here is my current solution:

 Parallelize[
   DeleteDuplicates[
     Flatten[Table[Divisors[n! - 1], {n, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59}]]]]

but it doesn't work. I don't know how to handle:

"Parallelize::nopar1: DeleteDuplicates[Flatten[Table[Divisors[n!-1],{n,50,51,52,53,54,55,56,57,58,59}]]] cannot be parallelized; proceeding with sequential evaluation."

$\endgroup$

closed as off-topic by MarcoB, m_goldberg, user9660, Yves Klett, Jens Jun 16 '16 at 18:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, m_goldberg, Community, Yves Klett, Jens
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    $\begingroup$ Seemingly altering to this form can solve the problem: DeleteDuplicates@Flatten@ParallelTable[Divisors[n! - 1], {n, Range[50,100]}] $\endgroup$ – Wjx Jun 12 '16 at 23:18
  • 1
    $\begingroup$ I suspect that this is because DeleteDuplicates needs to see the whole list to do its job: its operation cannot conceptually be parallelized. Table, on the other hand, can be handily parallellized. In other words, the Parallelize algorithms are not smart enough to identify this issue, so they give up. Generally speaking, however, parallelizing code is a difficulty task even for humans, and I can't fault the algorithm. As a hint, those commands for which a Parallel* version exists (e.g. ParallelTable) are the easiest to parallelize, so you should try to use those preferentially. $\endgroup$ – MarcoB Jun 12 '16 at 23:50
  • 1
    $\begingroup$ Replace {n, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59} with {n, {50, 51, 52, 53, 54, 55, 56, 57, 58, 59}} $\endgroup$ – xyz Jun 13 '16 at 2:04

Browse other questions tagged or ask your own question.