Roger Hui wrote:
> icol1=: # - +/@(+./\)@(1&=)
>
> See also:
> http://www.jsoftware.com/jwiki/Essays/Collatz_Conjecture

Thanks, Roger!

Perhaps you could also help me on another question from this context.   I
have a function f to evaluate on an array a.  Since f is expensive, I
evaluate it on the nub and distribute the results.  The NUB adverb in the
Dictionary does not work because the arrays are too big, so I use another
verb g which is much faster, but not optimal.

For example:

   a=:10 | i.100
   f=:*:
   g=: (~. i. ]) { f @:~.
   (f-:g) i.100
1

I know I ought to be able to do better by only evaluating the nub once,
but I can't see how to do it.

Best wishes,

John



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

Reply via email to