What is the best way to sort X numbers into an Y positions "circle" to avoid any repetition of Z elements, minimizing consecutive numbers?

9 Views Asked by At

Please, what is the best way to sort X numbers into an Y positions "circle" to avoid repetition of any Z consecutive elements, minimizing consecutives?

So let me try to better explain:

  • A. Suppose I have a 100 (Y) positions circle, like 100 (Y) boxes that I need to fill with numbers in this circle;
  • B. I want to avoid the repetition of any 3 (Z) numbers combinations. So if I select/form the sequence "1,9,17", this combination cannot appear again in the circle in any combination: "1,9,17" - "1,17,9" - "17,9,1" - "17,1,9" and so on;
  • C. Also, I want to minimize numbers that are closer to each other to be "selected" near each other. So the sequences "1,2,3" and "8,9,10" are very bad, while "1,9,17" is very good.

I would like to know:

  • How many different numbers (X) I need to satisfy A and B;
  • Is there an optimal algorithm to satisfy B and ideally also C?

The "circle" part becomes less important with a high Y, so maybe its almost irrelevant for the problem.

I'm asking here because this is problem that I don't even know to to start approaching. Of course I could brute force the stuff using a simple program, but I would like to understand a real math approach.

Thanks!