Wow -- that's great stuff. I tried it, and it worked a treat. If I understand correctly, the &. command joins the i. and the (p:^:_1), which is the inverse of p:. So this command says: apply the inverse of the prime function to 10000 to find what the order of that prime is, then iterate up to that number, then get the primes up to that index. I'm curious -- how is the use of &. better than just writing out what is needed. As far as I can see these are equivalent:

i.&.(p:^:_1)10000
p:i.(p:^:_1)10000

They take the same number of characters to type, so why is the former preferred to the latter?

regards,

Geoff

On Mar 4, 2007, at 12:42 AM, Raul Miller wrote:

On 3/4/07, Geoff Canyon <[EMAIL PROTECTED]> wrote:
based on a calculation? For example, suppose I want to generate all
the primes < 10,000.

  i.&.(p:^:_1)10000

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to