16 questions linked to/from Partition a set into subsets of size $k$
196 views

### Listing all distinct exhaustive combinations of sublists of a certain length [duplicate]

I would like to do the following: Suppose there is a list {a, b, c, d}. I would like to get all distinct exhaustive combinations of its sublists of a certain ...
121 views

### How can I revise my program to avoid “No more memory available”? [duplicate]

I have a program for calculating a type of list. ...
102 views

### Construct all possible sets of pairs [duplicate]

I am looking for a nice way of constructing all possible pairings of a given list. Currently I am using the brute force approach of sieving the 2-partitions of all permutations. ...
67 views

### Separate list elements into groups of two in all possible ways? [duplicate]

Consider a list with an even number of elements, e.g. list = {1,2,3,4}; I would like to have a function fun that produces all ...
58 views

### Generating partitions of a set with a specified size of the parts [duplicate]

I tried the following (inspired by the answer here) myList = {a, b, c}; Needs["Combinatorica`"]; SetPartitions[myList] and I got this answer, ...
656 views

### How to generate all possible orderless partitions of a list according to another list?

This question is hard to describe in plain text. So I will post an example and a working code (brute force) to illustrate. For example I have a list: ...
2k views

### Find all the possible ways of partitioning a list into a set of pairs of element

I have a list {x1,...,xN} where N is even, and I need to find all the possible ways to split it into pairs of elements, e.g. the ...
661 views

### Partition a set into $k$ non-empty subsets

The Stirling number of the second kind is the number of ways to partition a set of $n$ objects into $k$ non-empty subsets. In Mathematica, this is implemented as ...
1k views

### Finding all length-n words on an alphabet that have a specified number of each letter

For example, I might want to generate all length n=6 words on the alphabet {A, B, C} that have one ...
957 views

### How to construct the RHS of Wick's theorem

I've been trying this for a few days now, but I just can't seem to find an efficient (speed-wise) functional way to code the following task. Context: I would like to construct an expressions that is ...
426 views

### Enumerate the 1-factors (perfect matchings) of $K_n$

Introduction I would like to enumerate the 1-factors, or (near-)perfect matchings, of the complete graph Kn. The adjacency list representation for Kn is basically { (x, y) | 1 ≤ x < y ≤ n }. For ...
704 views

How can I calculate only those permutations of Range[n], that satisfy certain rules? I don't want to filter the result after calculating all the permutations but ...
189 views

### Combinations which do not have elements in common

I can choose 2 letters from the four letters $\{A,B,C,D\}$ in 6 combinations using the combination formula $$\frac{n!}{ r! (n-r)!}$$ ...
### NextKSizePartition, or how to partition a set into subsets of size $k$ but incrementally
This question might seem very much like the linked one below but it differs in a very special way; Mr.Wizard suggested I start a new post: Partition a set into subsets of size $k$ What I want is to ...