Generate all binary strings/patterns of a given length which are unique even when rotated

44 Views Asked by At

I need an algorithm that behaves like this:

In: 1 Out: 0, 1

In: 2 Out: 00, 01/10, 11

In: 3 Out: 000, 001/010/100, 011/110/101, 111

In: 4 Out: 0000, 0001/0010/0100/1000, 0011/0110/1100/1001, 0101/1010, 0111/1110/1101/1011, 1111

of the separated using "/", only one of them should be given, which one doesn't matter.

Honestly I'm not sure whether such an algorithm even exists. I found some promising examples under the keyword "cyclic code", but I don't understand the underlying math (galois fields) nearly enough to determine whether this would be a viable approach.

I tried to understand cyclic codes (https://en.wikipedia.org/wiki/Cyclic_code), but failed to do so. I searched for libraries that can generate cyclic codes, but they always seem to be operating on blocks rather than bits.

0

There are 0 best solutions below