lr'lr'
5!:5@<

Eesuk's explicit generalization of a classic solution:
   
   lr'involute0'
3 : 0
 t=.<./'M N'=.y
 p=.,t{.|:(>:i.-N),:i.-M
 d=.(+:t)$(,-)1,N
 y$/:+/\p#d
)

Eesuk's tacit version:
   
   lr'involute1'
$ /:@(+/\)@(,@(<./ {. |:@(1 0 + [EMAIL PROTECTED]@|.)) # +:@<./ $ (, -)@(1 , 
{:))

A slight variation:
   
   lr'involute2'
([ $ /:@(+/\@(,@(] {. |:@((1 0 + [EMAIL PROTECTED]@|.)@[)) # +:@] $ (, -)@(1 , 
{:@[)))) {.
   
   lr'st'
7!:2 , 6!:2
      
   st'involute0 400 600'
6302784 0.025494581
   st'involute1 400 600'
4195328 0.0252504159
   st'involute2 400 600'
3155008 0.0255353683


bill lam 
Wed Nov 29 11:44:59 HKT 2006 
[Jprogramming] spiral order 

 
Did anyone compare timing of vairous solutions presented in this forum with
classic solutions in http://www.jsoftware.com/papers/play132.htm ? It may need
to modify evolute to involute before testing.

Eugene McDonnell wrote:
> 
> On Nov 26, 2006, at 12:18 AM, Roger Hui wrote:
> 
>> Now that we have mastered zigzag order, how about the
>> spiral order?  For example, the spiral order for a
>> 4 5 array is:
>>
>>  0  1  2  3 4
>> 13 14 15 16 5
>> 12 19 18 17 6
>> 11 10  9  8 7
>>
> 
> My  At Play With J article "Volutes" in Vector 13.2 (October 1996) gives
> several solutions to the problem, but I doubt many people could improve
> Joey Tuttle's amazing one.
> ----------------------------------------------------------------------
> 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