tgu3=: 3 : 0
i=. /:y
p=. 1 (0})^:(*#y) (~: _1&|.) i{y
i/:i++/\p*#y
)
x=: ,(0,-9!:18'')+/1+i.5e5
(tgu -: tgu3) x
1
ts=: 6!:2 , 7!:[EMAIL PROTECTED]
ts 'tgu x'
2.62876 1.15827e8
ts 'tgu3 x'
1.54044 3.9324e7
----- Original Message -----
From: [EMAIL PROTECTED]
Date: Thursday, May 31, 2007 4:10 pm
Subject: Re: [Jgeneral] Re: Challenge to expert J'ers
> I also forgot the empty case (shame on me) so here they are again:
> tgu=: 3 : 0
> if. (0 e. $ y) do. y return. end.
> ix=./:y
> sy=.ix{y
> p=.sy~:_1|.sy
> one=.1
> p=.one 0}p
> sy=.p < ;.1 ix{i.#y
> ;(/:&.>sy){&.>sy
> )
>
> tgd=: 3 : 0
> if. (0 e. $ y) do. y return. end.
> ix=.\:y
> sy=.ix{y
> p=:sy~:_1|.sy
> one=.1
> p=.one 0}p
> sy=.p < ;.1 ix{i.#y
> ;(\:&.>sy){&.>sy
> )
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm