Is there a way for me to generate a list of permutations in "chunks" such that I needn't store everything on RAM all at once?
Consider that (WARNING: DO NOT RUN! --- Will generate a list with 13! = 6,227,020,800 entries!)
Permutations[{"t1","t2","t3","t4","t5","t6","t7","t8","t9","t10","t11","t12","t13"}]
Will obviously not be storable on a standard personal computer.
However, is there a way for me to ask Mathematica for the a "chunk" of permutations with indices $n_1$ through $n_2$ where, hypothetically if we had the output for Permutations above, $n_1$ would be the index of the first element in the chunk we ask for and $n_2$ would be the index of the last element in the chunk we ask for?
For example:
smallEx=Permutations[{"t1","t2","t3"}];
Gives the output:
{{"t1", "t2", "t3"}, {"t1", "t3", "t2"}, {"t2", "t1", "t3"}, {"t2", "t3", "t1"}, {"t3", "t1", "t2"}, {"t3", "t2", "t1"}};
I was hoping for some way to write a function like:
PermutationChunk[{"t1","t2","t3"}, {3,5}]
That in this case, with $(n_1,n_2)$ = {3,5}, would return:
{{"t2", "t1", "t3"}, {"t2", "t3", "t1"}, {"t3", "t1", "t2"}}
Or a single permutation for:
PermutationChunk[{"t1","t2","t3"}, {2,2}]
Out:
{"t1", "t3", "t2"}
Is this possible?
Subsets
. $\endgroup$