2

A state is a binary sequence made up of 4 bits.

Initially, there's a random and unknown state. You can choose to XOR the state with any other state. Then, the state is randomly permuted in a circular manner. This process can repeat multiple times. Can you guarantee to reach the $(0,0,0,0)$ state regardless of the initial state?

The source of the problem is unknown and I have tried to observe the behavior on different inputs, but I don't have anything specific to post.

No One
  • 61
  • If you reach $\ (0,0,0,0)\ $ do you get notified as soon as you've done so? If so, then yes, I think you can guarantee to annihilate the state within a fixed finite number of moves. – lonza leggiera Apr 15 '23 at 12:55
  • Yes, you are notified you've done so. How do you prove you can do it within a fixed number of moves? – No One Apr 15 '23 at 13:02
  • When you say it is randomly permuted, do you mean that it can be permuted by 1-shift, or 2 shifts, or 3-shifts but not stay still (0-shift) ? – Jean Marie Apr 15 '23 at 14:34
  • In you last comment, when you say "a fixed number of moves" you surely mean a "finite number of moves", isn't it ? – Jean Marie Apr 15 '23 at 14:35
  • The state can remain the same after being permuted. And yes, in a finite number of moves. – No One Apr 15 '23 at 14:55
  • When you say "You can choose to XOR the state s with any other state $s_1$", do we have a modification : new s = XOR$(\text{old } s, s_1)$ or does $s$ remains the same ? – Jean Marie Apr 15 '23 at 21:36
  • @Jean Marie If I've understood the question correctly, I've proved that you can guarantee to annihilate the state within $16$ moves. I've written up the proof, but the question has now been closed, so I can't post it. – lonza leggiera Apr 16 '23 at 00:37
  • @lonza leggiera It's a pity ! I would be so interested ! I incitate you to create a "follow on" question of your own, stating the problem with a short reference to the initial question and all at once answering your question. This has been done rather frequently. Meanwhile, feel free to make a little "Edit" in my answer (with your own signature) explaining only the principle of your solution and sending readers to your "follow on" question. In any case, let me know. – Jean Marie Apr 16 '23 at 03:59
  • @lonza leggiera Here is an example (interesting in its own) among many of a "Q&A". – Jean Marie Apr 16 '23 at 04:19
  • @Jean Marie Here are the sixteen sequences to successively XOR to whatever state you've reached :$$1.\ 0000\2.\ 1111\3.\ 0101\4.\ 1111\5.\ 0011\6.\ 1111\7.\ 0101\8.\ 1111\9.\ 0001\10.\ 1111\11.\ 0101\12.\ 1111\13.\ 0011\14.\ 1111\15.\ 0101\16.\ 1111\ .$$ I'm assuming here that if $\ S\ $ is the current state, $\ M\ $ is the sequence XORed onto it, and $\ S\oplus M\ne0000\ $, then next state will be a random circular shift of $\ S\oplus M\ $. – lonza leggiera Apr 16 '23 at 05:13
  • @lonza leggiera I just checked : it works wonderfully : I have observed on a large scale simulation that random variable S (stopping time) is uniformly distributed on [1,16] giving E(S)=8.5. Please write this "Q&A" where you will explain how you have had the idea of this sequence. – Jean Marie Apr 16 '23 at 05:45
  • @lonza leggiera In fact, it also works (in at most 16 steps) for any shuffle of the rows of your $16 \times 4$ array of the form $n \in [0,15] \to a∗n \in [0,15]$ (where $a$ is any odd number ; please note that I use here a line numbering beginning at $0$). – Jean Marie Apr 16 '23 at 07:26
  • @lonza leggiera Thank you ! – Jean Marie Apr 17 '23 at 06:05
  • 1
    @Jean Marie I finally bothered following all the links to the origin of the problem. It's a particular case (with $N=4$) of question $7$ (about the same problem for a general $N$) of the senior A-level Tournament of the Towns paper of autumn 2009, which can be found at this link: http://www.math.toronto.edu/oz/turgor/archives/TT2009F_SAproblems.pdf. The solution can be found on the solution sheet at this link: http://www.math.toronto.edu/oz/turgor/archives/TT2009F_SAsolutions.pdf. – lonza leggiera Apr 17 '23 at 06:20
  • 1
    As is typical with this sort of puzzle the thought processes I went through in deriving the above solution were rather convoluted, and I don't even remember most of them. My original proof that the above solution worked was an unenlightening collection of casework. On cleaning it up, however, I found a nice proof based on the lengths of the orbits of the group of circular shifts acting on the sequences. A nice question would be whether this proof can be generalise to cover the case of arbitrary $N=2^n$, which I am as yet unsure of. When I can find the time I'll write it up as a new question. – lonza leggiera Apr 17 '23 at 06:26
  • 1
    @Jean Marie Here's my write-up of the question. I now think I can generalise the solution to one for any $\ N=2^r\ $. – lonza leggiera Apr 19 '23 at 10:17

0 Answers0