I had thought the notion I had for pnm:

        (}: (^ * ^~) }.)@(p:@x:@i.)

would be slower than prh:

        2 */@(^ |.)\ p:@x:@i.

But they turn out not very different:

   (100) 6!:2 'prh 40'
   0.00277307
   (100) 6!:2 'pnm 40'
   0.00263127

   9!:14 ''
   j701/2011-01-10/11:25 build: Feb  6 2011 16:16:29


On 2014.10.17 16:48:30, I said,

> If one can take 2 3 5 and 3 5 7 as given, this might do:
> 
>  */2 3 5x (^ ,: ^~) 3 5 7x
> 
> If it was "do this for the first N primes", it would be
> a little more complicated.
> 
> 
> On 2014.10.17 18:30:14, you,
>  the extraordinary Kip Murray, spake thus:
> 
> > 
> > 72 30375 1313046875
> > 
> > The first of these numbers is (2^3) * (3^2) , the second is (3^5) * (5^3),
> > and the third is (5^7) * (7^5) .  You see the pattern involving successive
> > primes.
> > 
> > Write a J expression to produce the above list.  --Kip Murray
> > 

-- 
Nollaig MacKenzie
http://www.yorku.ca/nollaig
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to