In a related question I asked how to generate all the tuples of ones and zeroes with a fixed number of ones (generating tuples of ones and zeroes with a fixed number of ones). I wish to consider a more challenging problem. Here we have, for example, all the five-tuples with two ones, numbered on the right
{1, 1, 0, 0, 0}, (1)
{1, 0, 1, 0, 0}, (2)
{1, 0, 0, 1, 0}, (3)
{1, 0, 0, 0, 1}, (4)
{0, 1, 1, 0, 0}, (5)
{0, 1, 0, 1, 0}, (6)
{0, 1, 0, 0, 1}, (7)
{0, 0, 1, 1, 0}, (8)
{0, 0, 1, 0, 1}, (9)
{0, 0, 0, 1, 1}, (10)
However, note that tuples 1, 4, 5, 8, 10 are rotations of each other, and the remaining tuples are rotations of each other. What I want is to generate just two tuples, one corresponding to each rotation class, without generating the rest of the tuples, for example, say, {1, 1, 0, 0, 0}
and {1, 0, 1, 0, 0}
. I got very good answers to my previous question, but I can't quite see how to extend any of those answers to solve this problem. I would particularly like to see a solution which can be monitored with monitor as the solutions are generated. Only some of the solutions offered to my previous question have this feature, even though they are all great solutions. Many thanks in advance.