Jon,

You need the dyadic version of !,  though it does yCx rather than xCy:
   3!7
35

The following idiom delivers your required number of Steiner subsets:
    ({.%~/@:!}. ) 2 3 7

7

... if you're happy to treat the triples in this way.


It's derived from this verb which delivers 2!3 and 2!7:
   ({.!}.)2 3 7

3 21


You'll need to explore more to see how to handle more than one triple, say.


Does that help?
Mike



On 26/02/2014 15:25, Jon Hough wrote:
I have a question about doing combinations and permutations with J.
There is an easy to use factorial function (or is that verb) : !
!5120
Is there a combination verb? Or do I make my own?
((!3)*!(7-3))%~!7
Gives 7 choose 3. I think I butchered that. Is there a better way to do this, 
without all the brackets?
Now I want to think about more complicated combinatorial objects: Steiner 
Systemshttp://en.wikipedia.org/wiki/Steiner_system
Essentially a Steiner System is defined by three numbers a,b,c such that we have a total of c 
points and we collect the points into subsets of size b, such that for any "a" points 
(where a < b < c) there is exactly one subset containing all three:example a,b,c=2,3,7 we 
have the S(2,3,7) steiner system with points 0~6, the subsets are012   034   056   135   146   
236   245Note, every  pair of points is in exactly one subset.
For a given Steiner system, to calculate the number of subsets (in the above 
case 7) there is a simple eqn:
num = (c choose a)/(b choose a)
I would like to write this as a verb (preferrably tacit).I have immediately run 
into a problem:this verb would take three arguments. Not sure how to do that.
I would like some help writing this verb. Thanks in advance.
Regards,Jon                                     
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm



---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com

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

Reply via email to