a.  Do you mean gcd or lcm?  *./ computes the lcm.

b. I am skeptical that *./ is slower than another method
that involves factoring.  Factoring is a hard problem;
gcd/lcm are easy problems.



----- Original Message -----
From: Raul Miller <[EMAIL PROTECTED]>
Date: Friday, December 14, 2007 6:51
Subject: Re: [Jprogramming] 61 statements
To: Programming forum <[email protected]>

> On Dec 14, 2007 8:42 AM, Don Guinn <[EMAIL PROTECTED]> wrote:
> > It seems to me that another problem would be to find a general 
> solution> which runs quickly for very large numbers.
> 
> gcd=: *./@x:
> gcd=: ([:x:>./)&.(_&q:) NB. fast version
> 
> F=:gcd@:>:@i.%((]+:@x:@[EMAIL PROTECTED]>:*.-:@[<])(-.]-.]&.(p:inv))@(1 
> _1+2^2<[EMAIL PROTECTED]))
> (hopefully this is short enough that it won't wrap.)


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

Reply via email to