You can make it slightly faster by

   gi2=: ,~ [:>:[:>./ -@:>:@:i.@:<.@:-:@:# (0 i.~2-:/\])@(]\) ]
   gij2=: 3 :'|. gi2^:(y-2) 1 1'


R.E. Boss


> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:programming-
> [email protected]] Namens Zsbán Ambrus
> Verzonden: dinsdag 3 augustus 2010 21:57
> Aan: [email protected]
> Onderwerp: Re: [Jprogramming] Generate the Gijswijt's sequence (A090822)
> 
> The following is almost the same as my original code except it's
> significantly faster (but it's still very slow).
> 
>    gi1=: , [:>:[:>./ -@:>:@:i.@:<.@:-:@:# (0 i.~2-:/\])@(]\) |.
>    gij=: 3 :'gi1^:(y-2) 1 1'
>    gij 30
> 1 1 2 1 1 2 2 2 3 1 1 2 1 1 2 2 2 3 2 1 1 2 1 1 2 2 2 3 1 1
> 
> Ambrus
> ----------------------------------------------------------------------
> 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