Questions tagged [combinatorics]
Questions on the use of Mathematica in combinatorics, including the Combinatorica add-on package.
122
questions
4
votes
3
answers
361
views
Permutation count for sets with multiplicities
I am able to do a permutation counr for the set {a, a, b} which gives me 3 groups. I am happy with that result. However, if the set is ...
4
votes
3
answers
232
views
Finding specific compositions of an Integer
I need to find all compositions of an integer L wherein all parts do not exсeed l and parts less then l cound not be neighbor. Here is my code
...
4
votes
2
answers
368
views
How to correctly enumerate all the schemes of this cube coloring problem?
This problem is the fifth question of 1996 Chinese High School Mathematics League or Chinese Mathematical Olympiad in Senior:
Choose several colors from the given six different colors to dye six faces ...
4
votes
2
answers
595
views
Partition a range of integers into triples
Some time ago, I was asked to look at a simple to formulate puzzle. Consider the list of numbers {1,2, ..., 33}. Try to split this list in 11 triples, such that in ...
3
votes
3
answers
260
views
Permutations on elements a>b && b>c
A={1, 2, 3, 4, 5}
Permutations[A, {3}]
I need to print all permutations where the first number is bigger than the
second and the second number is bigger than the ...
3
votes
0
answers
95
views
Listing all combinations produced by picking one element from each of several sets [duplicate]
I have a problem like this, I am given the following sets {a,b,c}, {d,e,f}, {h,i,j}. I want to pick one element from each set, and output a list of all the ...
3
votes
1
answer
216
views
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 ...
3
votes
3
answers
188
views
How to delete duplicate graphics of the same kind?
A054247: Number of n X n binary matrices under action of dihedral group of the square D_4.
...
3
votes
2
answers
95
views
Generating representatives of rotation classes of tuples of ones and zeros with a fixed number of ones
In a related question I asked how to generate all the tuples of ones and zeroes with a fixed number of ones (generating tuples of ones and zeroes with a fixed number of ones). I wish to consider a ...
3
votes
1
answer
160
views
Recursive solution to the extended Josephus problem [duplicate]
The Josephus Problem is described here, with extension of killing every $k$th problem. In the simple case where every other person is killed, we can also use the binary trick.
...
3
votes
2
answers
314
views
Generating invertible matrix with lines within a given set
Consider the set options given as below
...
2
votes
1
answer
635
views
Inclusion-Exclusion Principle Implementation
I would like to know how I can write a Mathematica code for the Inclusion–exclusion principle.
The formulas governing it are:
$
P(\bigcup_{i=1}^n A_i)=\sum_{k=1}^n (-1)^{k-1} \sum_{\substack{I\...
2
votes
2
answers
391
views
Finding Non-Simple Paths of a Given Length on a Graph
For the following graph:
...
2
votes
2
answers
540
views
Making a flag with six vertical stripes
A flag is to be made with six vertical stripes by using colours yellow, blue, green and red in such a way that no two adjacent stripes should have the same colour. In how many ways is this possible? ...
2
votes
1
answer
177
views
How to accelerate combinations and sum calculations here?
I have a 4d matrix H defined as below (embedded with combinations and sums)
...
2
votes
2
answers
184
views
How many equation systems can I build from five equations?
Suppose I have five quantities:
A1 = 4; A2 = 2 + 4b; A3 = a + 6 b; A4 = 10 b; A5 = 4 a
I want to make as many systems of equations as I can from these five ...
2
votes
1
answer
104
views
Splitting balls over sized bins
This is strongly related to Splitting a set of integers over a set of bins, but a much simpler case.
If we have $N$ indistinguishable balls and $k$ arbitrarily large distinguishable bins, we know the ...
2
votes
2
answers
256
views
Refining subset relations
People who do combinatorics (like me) are often faced with the following problem:
For a list of combinatorial objects (vectors, permutations graphs,etc.), we know what multi-set of values it ...
1
vote
1
answer
150
views
How to efficiently replace the repetitive sequence?
The problem is how to determine the repetitive sequences and replace the part with consecutive sequences
For example:
A={{1,3,4},{2,3,5},{1,6}}
Then, detect there ...
1
vote
0
answers
252
views
Wilf-Zeilberger algorithm in Mathematica [duplicate]
I am trying to prove the q-combinatorial identity
$$\sum_{s=0}^r(-1)^sq^{\frac{s(s+1)}{2}}{n-2r+s\brack n-2r}_q{n\brack r-s}_q=\sum_{s=0}^{r-1}(-1)^{s+1}q^{\frac{s(s+1)}{2}}{n-2r+s\brack n-2r}_q{n\...
1
vote
1
answer
570
views
How do I upload a graph as an adjacency list and find the betweenness centrality?
I have an undirected simple graph in a .txt file formatted as an adjacency list like this:
100 200
200 300
300
400 500 600 700 800 900
...
Every number is a node ...
1
vote
3
answers
308
views
How to use Mathematica to solve this problem of planting tree
To plant trees at the center of each small square in a 3 * 4 rectangular area, it is required that there should be no continuous number of three (or more) trees in three directions of Horizontal, ...