Roger Hui wrote: > The J solution can be shortened by removing the >. . Thus: > > nplt=: p:^:_1 NB. #primes < n > plt =: i.&.(p:^:_1) NB. primes < n > nsp =: 3 : '+/ (nplt@(y&%) - [EMAIL PROTECTED]) plt %:y' " 0 >
Here is a variant which is less efficient, but possibly more readable. nsp3 =: 3 : '+/(nplt@(y&%)-nplt) plt %:y' " 0 Note that the [EMAIL PROTECTED] in Roger's solution could be computed separately. I use a more complicated calculation which expresses its role. Best wishes, John ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
