Sieve of Pritchard: Difference between revisions

→‎{{header|J}}: a note of explanation
(→‎Julia: Added "collect()" on "adding" portion, which avoids unnecessary attempts at adding items that were already added, cuts execution time. Reduced "add" stat from 786987 down to 186825 when tabulating 1000000.)
(→‎{{header|J}}: a note of explanation)
Line 181:
Task example:<syntaxhighlight lang="j"> pritchard 150
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149</syntaxhighlight>
 
This task exposed a bug in J's implementation of X i. Y when X is an empty sparse array. To avoid work around this bug, we initialize <code>spokes</code> and <code>primes</code> with the values that they would have had after the first two iterations of this algorithm if <code>i.</code> would have worked properly. (The bug has been fixed, but the fix is not yet widely deployed.)
 
=={{header|Julia}}==
6,962

edits