Matrix of possible combinations of N elements

*To*: mathgroup at smc.vnet.net*Subject*: [mg31830] Matrix of possible combinations of N elements*From*: "Per Schjetne" <per.schjetne at dmhuset.no>*Date*: Wed, 5 Dec 2001 06:51:59 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

I have N elements and want to make a matrix of all possible combinations. Example: A, B, C, D -> 4 elements Combinations with 2 similar characters are not allowed (AAAA, AABB etc) So that gives me 4*3*2*1=24 unique combinations I have no problem writing all the combinations down, but I find it hard to make a general function/algorithm in VB for generating matrix of any number of elements. I know this is a common problem and instead of using days on this problem I ask you gurus here! Per :-)

**Follow-Ups**:**Re: Matrix of possible combinations of N elements***From:*Tomas Garza <tgarza01@prodigy.net.mx>