Skip to main content

All Questions

5 votes
1 answer
161 views

Find permutation that satisfies conditions

Suppose you what to find a permutation of integers {1, 2, ..., 13} that satisfy some rules. Rules can be found in variable rules....
azerbajdzan's user avatar
  • 20.1k
7 votes
9 answers
614 views

Rearrange triple sublists

Given a set of triple lists (all contain element 9!) tripel = {{5, 10, 9}, {4, 9, 3}, {3, 9, 8}, {4, 5, 9}, {9, 10, 8}} I would ...
Ulrich Neumann's user avatar
9 votes
9 answers
932 views

Shuffling two lists into each other

Given a subset s of Range[n] and two lists a and b, with ...
მამუკა ჯიბლაძე's user avatar
1 vote
1 answer
84 views

Value of a function over permutations of two lists

I want to do the sum (in Ising lattice gauge theory) ...
QFTheorist's user avatar
4 votes
4 answers
261 views

How to confirm two sets contain the same vectors in any order?

Say if I have two sets of vectors, for example: $$v_{1}=((0,0,0),(0,1,0),(0,0,1),(1,1,1))$$ $$v_{2}=((0,1,0),(1,1,1),(0,0,0),(0,0,1))$$ I want to find a way of verifying that both $v_{1}$ and $v_{2}$ ...
am567's user avatar
  • 627
1 vote
2 answers
127 views

Delete the subsets containing the same $2$ integers present in other subsets

From my previous question, if I consider a list like this: $\{$$\{$$\{$$1,2,3$$\}$,$\{$$4,5,6$$\}$$\}$, $\{$$\{$$1,2,4$$\}$,$\{$$3,5,6$$\}$$\}$, $\{$$\{$$1,2,5$$\}$,$\{$$3,4,6$$\}$$\}$, $\{$$\{$$1,2,6$...
user967210's user avatar
7 votes
3 answers
245 views

Permutations with subsets not containing the same elements

I would like to define a function of two integer variables $ \{n, k\} $, with $ k | n $, that would print all the possible permutations of the first $ n$ positive integers, such that the subsets of $ ...
user967210's user avatar
4 votes
2 answers
182 views

Generating all possible 2x2 matrices with unique elements from 1 to 4

If I have a set A={1,2,3,4}, how do I generate all 2x2 matrices with different elements chosen from ...
Karim Ezzat Messilhy's user avatar
1 vote
2 answers
140 views

How to get all necklaces without the full permutations' set?

There are previous posts, such as Delete duplicates from list of lists as if on a necklace, that give a way to find all necklaces from a set of lists. The methods presented there work well for a small ...
Kostas's user avatar
  • 65
3 votes
4 answers
250 views

Working with tables: add new level of nested tables

I am trying to obtain all possible combinations of elements in a (long) list factors = {A, B, C}; getCombinations[factors,n] For n = 3 factors, it should give <...
Albercoc's user avatar
  • 998
6 votes
6 answers
265 views

How to efficiently find all element combination including a certain element in the list

I have the following list : alist={{5, 6, 7}, {7, 6, 8}, {5, 7, 25}, {7, 8, 26}, {7, 26, 25}, {5, 4, 6}, {4, 12, 6}, {6, 12, 13}, {6, 13, 8}} I want to find all ...
mmmm's user avatar
  • 105
4 votes
3 answers
343 views

Find all sets whose index is divisible by the elements

Suppose I have such a set $S=\{3,4,5,...n+2\}, n\in \mathbb{Z}_{>\, 0} $, $a_n$ is any permutation of $S$ such that $n|a_n$, I want to know how many such $a_n$. The easy but inefficient way to do ...
expression's user avatar
  • 5,662
1 vote
2 answers
208 views

Generating Lyndon words modulo mirroring operation and substituion

I have two letters A,B. I want to generate all words say up to length 22 with the following properties. There is no "canonical" list so any such list will suffice, though there are many ...
2132123's user avatar
  • 657
17 votes
12 answers
4k views

Fastest way to generate {{a,a},{a,b},{a,c},{b,b},{b,c},{c,c}} from {a,b,c}

What is the fastest way to generate {{a,a},{a,b},{a,c},{b,b},{b,c},{c,c}} from l={a,b,c}? I've tried ...
Thrash's user avatar
  • 415
4 votes
3 answers
139 views

How to find the cycle type vector of a random permutation

Given a random permutation $\pi$ of {1,2,...,n}, I want to produce a list {a1,a2,...,an} of nonnegative integers so that ai is the number of cycles in $\pi$ of length i for each i=1,2,...,n. For ...
geoffrey's user avatar
  • 867

15 30 50 per page
1
2 3 4 5 6