Roger Hui gave a non-unique pair algorithm as below:

Roger Hui rhui000 at shaw.ca 
Sat Feb 10 02:49:22 HKT 2007

Combinations are usually defined to have unique elements.
http://www.jsoftware.com/jwiki/Essays/Combinations
However, if non-unique is what you want:

   ; (i. ([ ,. }.)&.> <@i.) 4
0 0
0 1
0 2
0 3
1 1
1 2
1 3
2 2
2 3
3 3

How would I go about having non-unique triplets, quadruplets etc.


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

Reply via email to