Comment by Max Alekseyev for This is a corrected version of the thought...
What is incorrect in my code? It looks like you just re-implement the functionality of `itertools.groupby()` function with quite a bunch of code. Use of `itertools.groupby()` looks more elegant to me.
View ArticleComment by Quinten87 for This is a corrected version of the thought process...
I'm not overly comfortable with itertools.groupby() (hence I didn't use it), but I agree it seems more elegant. The problem is your code will only generate permutations that on each set of m identical...
View ArticleComment by Quinten87 for This is a corrected version of the thought process...
After looking it up, I realised I missed the most obvious set of generators, namely (1 2), (2 3),...(n-1 n). I edited it to do this as the integer partitions thing is unnecessarily complicated. If I...
View ArticleComment by Max Alekseyev for This is a corrected version of the thought...
Yes, my code did not address the case when some element repeats more than twice. Now, it's corrected.
View ArticleAnswer by Quinten87 for I'm looking for a good way to compute all the...
This is a corrected version of the thought process provided by Max Alekseyev (it copies some of his code as well). I didn't realise Sagemath had so many built in features to manipulate groups, and...
View ArticleComment by Quinten87 for Here is a possible approach. It first finds one...
Thanks for the reply! However, this algorithm does not work. For example, one can choose dP = [1,1,1] and it will only generate three permutations, whereas we should have 3! = 6. The problem is your...
View ArticleComment by Max Alekseyev for Here is a possible approach. It first finds one...
Thanks! Now it's corrected.
View ArticleComment by Quinten87 for Here is a possible approach. It first finds one...
Yep, looks like it works now; I'll accept this answer. Thanks for helping me out.
View ArticleAnswer by Max Alekseyev for I'm looking for a good way to compute all the...
Here is a possible approach. It first finds one permutation `p` that sorts a given list, then constructs a subgroup a permutations that fix the sorted list, and then reports the product of `p` and the...
View ArticleEfficient way to compute all possible permutations that sort a list
I'm looking for a good way to compute all the possible permutations that sort a list. For example, if the list is [3,4,3,2,4] I would want the permutations to be: [4,1,3,2,5], [4,1,3,5,2], [4,3,1,2,5],...
View Article
More Pages to Explore .....