I would like MMA to only calculate some of the permutations of a set. I am currently doing something along the lines of
Permutations[Flatten[{Array[1 &, #], Array[0 &, # (# - 1)]}, 1]] &@3
and using Take and Drop before performing further calculation on smaller set.
For $n=3$ as above, this is fine, but since hte above calculation gives ${n^2}\choose{n}$ different permutations, asking MMA to calculate anything above $n=6$ results in SystemException["MemoryAllocationFailure"].
I don't know the algorithm used to calculate Permutations, but is there any way of calculating and returning only permutations between x and y?
Combinatoricapackage has a function calledNextPermutation– vapor Mar 18 '17 at 07:10x==1, but not for say, $1000$ permutations aroundx==n^2. – martin Mar 18 '17 at 07:13UnrankPermutation, it looks more suitable here, – vapor Mar 18 '17 at 07:15UnrankPermutation[3, Flatten[{Array[1 &, #], Array[0 &, # (# - 1)]}, 1]] &@3but nothing much happening – martin Mar 18 '17 at 07:17UnrankPermutation[#, {0, 0, 1}] & /@ Range[2, 4], but it will be a problem if you worry about duplicates, since the algorithm used for this function andNextPermutationdoes not remove duplicates – vapor Mar 18 '17 at 07:24