Justin Paston-Cooper asked:
> The problem is to find the smallest positive number 
> divisible by all of the numbers from 1 to 20.

>  Could anyone tell me how to get around this with my current
>  solution? How about some smarter solutions?

I haven't studied your current solution, but the "direct solution" is to
just ask for the least common multiple (LCM):


           *./ >: i. 10
        2520

           *./ >: i. 20
        232792560
           
-Dan


PS:  Encountering a new expression like  *./  (which I've never used outside
boolean lists before) refreshes my appreciation of J's design; it's so close
to  */  which is the "obvious" common multiple of the vector.



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

Reply via email to