# Questions tagged [combinatorics]

Questions on the use of Mathematica in combinatorics, including the Combinatorica add-on package.

350 questions
Filter by
Sorted by
Tagged with
100 views

### Find all permutations with a condition (part 2) [closed]

This question (21008) asks to find all permutations of {a, b, c} subject to a + b + c = n. The answer was provided by Dr. ...
124 views

### Speeding the computation of Landau's function

This computational question is based on this question of combinatorics on the Mathematics.SE. A permutation of a list of $n$ items, $\{ 1, 2, \ldots, n \}$, is of course a reordering of them. If ...
226 views

416 views

### Splitting a list into 2 sublists in all possible ways

I have a list and I want to split it into 2 sublists in all possible ways If S={1,2,3,4} I should get ...
106 views

### How do I calculate the number of possible cases of polynomial equation (combinations) in Mathematica?

if I have the equation $$f(x_1,x_2,x_3,x_4)=x_1x_3+x_2x_4+x_1x_2x_4+x_1x_2x_3x_4$$ How many equations are possible if two variables ? when $x_1=x$ and the other four are y when $x_2=x$ and the ...
127 views

### how to efficiently generate all directed graphs with 6 vertices

I am attempting to generate all non-isomorphic directed graphs with 6 vertices using command ListGraphs[6, Directed].But it does not work efficiently and takes a ...
953 views

### Permutations of nested parentheses (Dyck words)

How would I construct a function that outputs Dyck Words? e.g. - there are 14 words in $\mathcal{D}_{8}$: ...
145 views

### Fast creation of state transitions and probabilities?

Normally I'd wait until I'd fleshed/thought things out further but I find this interesting enough that I think others might. Take an ordered list of $N$ slots, integers from $[0,2]$. This represents ...
2k views

### Faster derangements?

I wonder what is the fastest method to generate derangements? Both the Combinatorica function and Martin Ender's answer to Permutations of lists of fixed even numbers are based on filtering the ...
308 views

### Wilf-Zeilberger simplification

I am working my way through the book "A=B" and doing some of the problems. One of them was to prove that: $$\frac{1}{{n+x \choose n+r}} \sum_{k=0}^n{n \choose k}{x\choose k+r}=1$$ I am able to ...
557 views

### Permutations of lists of fixed even numbers

Let's say we have this list list={3,6,5,21,23,76,1,28,96,54,77} I would like to know the number of permutations when every even number stays where it is and ...
692 views

### Number walls with mathematica

I want to create "number walls" of a user-defined number of rows with mathematica. (They look similar to a CompleteKaryTree.) Each pair of 2 values in a lower row ...
132 views

### Calculating partial binary Permutations

I would like MMA to only calculate some of the permutations of a set. I am currently doing something along the lines of ...
86 views

### How many combinations of certain variables add up to at least n?

I have a set of numbers, let's say: a=16 b=19 c=19 d=31 e=5 f=... etc. How to create a simple function that shows how many combinations of the letters add up to at least the number n? I have no clue ...
750 views

### How to “Prove” this summation result?

I have this messy function with $n$, $k$, $i$ integers: $$r(\rm n,k)=\frac{k 2^{1-2 \rm{n}} (2 k)! (-2 k+2 \rm{n}+1) (2 \rm{n}-2 k)!}{(k!)^2 \left(1-4 (i-k)^2\right) ((\rm{n}-k)!)^2}$$ I want to ...
243 views

### Integer partitions without repetitions

What combination of numbers makes a specific sum? The code below is not very effective, because it also gives answers in which a number is used more than once even though it was given in the list ...
104 views

### Summing factors of binomial coefficients - get general formula?

Consider summing more and more factors of binomial coefficients: ...
1k views

### List all possible license plate numbers

The length of license plate numbers is 6, with 2 letters and 4 numbers. The first two characters are letters and the last four are numbers. Example: AA1234. This is the code I have so far: ...
195 views

### Doing combinations of sub-sublists

To create a list of all the possible combinations of a sublist. I have a list, somewhat resembling the following format: ...
211 views

### Modified Multinomial formula

I am trying to compute an explicit formula using Mathematica for the following multinomial expression: \sum_{n_{1}+n_{2}+...+n_{M}=N}^{M} {N \choose n_{1},n_{2},...,n_{M }} \cdot ...
177 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 ...
463 views

### Duplicate Permutations with Tuples

Permutations without repetition (in Italian: simple dispositions) Permutations[{a, b, c, d}, {3}] or ...
696 views

### unordered Tuples [duplicate]

I gather from this question that there is no primitive to build unordered tuples. That is, I want to do the equivalent of the following: ...
98 views

### Choose numerical values according to given rules

General problem Given a set of logical expressions I need to find numbers with a margin between pairs that obey the logical rules. Example For the expression $m=n=o,p=q$ with a margin of 10 the ...
176 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\...
105 views

### How do you group cycles?

I want to define a function that takes a list of pairs as input and groups cycles, e.g. {{a1,a2},{b1,b2},{a2,a3},{c1,c2},{a3,a1},{b2,b1}} becomes ...
84 views

### More efficient ways of listing matchings of possible rolls of 10 dice by max matching

The question is inspired by a dice game named 'Tenzi'. You roll 10 dice and record the size of the largest matching (the face-value is irrelevant). Exhaustively, listing all combinations of matchings ...
220 views

### How does FindGeneratingFunction work?

How do FindGeneratingFunction and FindSequenceFunction work? How might one implement similar functionality from scratch in ...
138 views

### Applying the binomial theorem with an arbitrary exponent

I was asked a question by a student today. The solution I came up with seemed a bit suspicious, so I tried to verify it using Mathematica and failed. I created a PDF of my solution which can be found ...
255 views

### Listing sequence with rules

How would one go about listing all sequences S length 10 made up of a combination of a's and ...
130 views

### Understanding KnapsackSolve

I was playing around with the new KnapsackSolve function in Mathematica 11 and came across something odd that I don't understand. Perhaps someone could shed some ...
116 views

### Producing a list of all the pairs can be made by from two lists of equal length [closed]

I have two lists: {x1, x2, x3, x4, x5} and {y1, y2, y3, y4, y5} How can I get a list like the one below from them, where ...
290 views

### How to get a combination of lists from a large list? [closed]

I have a list with ten elements, for example: {x1,x2,x3,x4,x5,x6,x7,x8,x9,x10} I want to have all the combinations of the 3 elements-list like below: ...
228 views

### How to derive large Tuples (25^25, 50^50,100^100) under certain condition

My problem is that computer has no sufficient memory to calculate tuples of my list. A simple example can be given as follows: ...
59 views

### Faster solution to combinatorial problem of two-part contractions

Given a list of elements I need all possible pairings of elements with a leading factor that describes the number of permutations. A (ugly but) working version would be: ...
70 views

### Non-Simple Lattice Paths using PathGraph

I am encoding a lattice walk of steps North, South and East on $\mathbb{Z}^{2}$ between the two extremities of the $x$-axis: ...
907 views

132 views

### Strategies for simplifying recurrences with sums

The problem: Count the number of permutations of n distinct objects that leave none of them fixed. This is actually a well-studied problem with pretty well-...
78 views

### Non-trivial partitions of numbers using Combinatorica

I have made a code which gives back partitions of numbers in two Young diagrams (one Young diagram is trivial). For example, the partitions of 1 are ...
262 views

### How to efficiently generate unique combination from several lists

For example I have a list data={{1,3,2},{3,2,4},{2,4,3}} sublist of data has no duplicate elements. We know ...
333 views

After the usual and well-known warning General::compat: "Combinatorica Graph and Permutations functionality has been superseded by preloaded functionality..." ...
119 views

### Tuples with restrictions

SHORT VERSION Given 2t Ranges, each of length len, what is the fastest way of finding the ...