3 ms·
The generalized case that include sequences with repeated elements[1] are De Bruijn sequences[2]. These are cyclic sequences that contain each possible n-length
by pdkl95 8y ago
The generalized case that include sequences with repeated elements[1] are De Bruijn sequences[2]. These are cyclic sequences that contain each possible n-length string using k symbols, each appearing exactly once.
B(k=3, n=2) = 112132233
B(k=4, n=2) = 1121314223243344
B(k=3, n=3) = 111211312212313213322232333
[1] i.e. "111", which isn't a permutation of the set {1, 2, 3}, but can be made from the elements of that set
[2] https://en.wikipedia.org/wiki/De_Bruijn_sequence https://en.wikipedia.org/wiki/De_Bruijn_sequence
- deleted 8y ago[deleted]