Marshall wrote:
>     V =: N (2 -~/\ _1 , /:~@:? , ])&<: Q

BINGO.  Thank you!

So you're creating an ordered list of <:N unique numbers less than <:Q,
bookended with _1 and <:Q, and taking the *gaps between these numbers* as
the vector V.

I have a vague intution of why the sum of any such bookended vector of gaps
must necessarily be identically equal to N, but can you spell it out for
me?

>   require 'stats/base'
>   3 (] (2 -~/\ _1 , /:~@] , [)"_1 comb)&<: 7    

Also, you wanna take a whack at inverting your enumeration function here? 
That is, given an index i, produce the corresponding row from the table  
3 (] (2 -~/\ _1 , /:~@] , [)"_1 comb)&<: 7  .

-Dan


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

Reply via email to