On Dec 14, 2007 1:37 PM, Roger Hui <[EMAIL PROTECTED]> wrote:
> a. Do you mean gcd or lcm? *./ computes the lcm.

lcm -- sorry, I was not thinking.

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

   (([:x:>./)&.(_&q:) -: *./@x:) 1+i.10000
1
   ts'*./@x:1+i.10000'
1.335 912192
   ts'([:x:>./)&.(_&q:) 1+i.10000'
0.204629 6.8388e7

I believe *. takes longer because each
intermediate result must be factored.

That said, I am using memory rather inefficiently
in my "faster" version.

That said, note also that for this problem I do
have a better option.

Thanks,

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

Reply via email to