Roger, I'd definitely love to see your code in the mathschallenge
forum(yes, I have solved it myself). I'm interested in seeing how you
keep and update the (hash?) table efficiently.

2006/9/4, Roger Hui <[EMAIL PROTECTED]>:
Sorry, typo:
   f^:(i&<:)^:a: i

The constructs
   f^:proposition^:_
   f^:proposition^:a:
are tacit versions of "do while" and can be useful.



----- Original Message -----
From: Roger Hui <[EMAIL PROTECTED]>
Date: Sunday, September 3, 2006 5:00 pm
Subject: Re: [Jprogramming] Mathschallenge Problem 14

> My solution is 16 lines and takes 23 seconds on a
> 2.2 GHz Athlon.
>
> a. Use for_i. i.n instead of while.
>
> b. Use a [EMAIL PROTECTED] verb instead of control structures
> to implement the logic
> if odd do 1+3*n
> if even do n%2
>
> c. Use f^:^:(i&<:)^:a: i to get the entire sequence
> on its way from i to j where j is less than i and
> already in the table; update the table using the
> entire sequence.


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

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

Reply via email to