V
V
VMesser2018-05-23 13:40:03
Mathematics
VMesser, 2018-05-23 13:40:03

How to solve such a problem in Boolean algebra?

I ran into an online test, there are some points in the task that are incomprehensible to me.

Which statements are true for the sequence of numbers generated by the algorithm? (only one answer)
for i = 0..2^k-1
    output(i^(i>>1))
Где ^ - побитовый XOR
>> - сдвиг на один бит вправо

1. The next number is always greater than the previous one
2. The i-th bit of the next number stores the modulo two sum of all bits of the previous number whose position numbers are less than or equal to i.
b_i = ( \sum_{j=0} ^ {i} a_i ) % 2
3. The bit representation of the next number differs from the previous one in only one bit.
4. Without the first element, the sequence is the following:
seq(2^k)
seq(2^k) = seq(2^{k-1}) 2^k seq seq(2^{k-1})
seq(1 ) = 1

What I can and have already done:
1. I took some k and got a sequence of intermediate results to look at. This takes a lot of time, obviously here you have to work not with your hands.
2. I understand what xor is
3. I understand that shifting one bit to the right gives division modulo 2
4. I googled the syntax of the sequences from the answers - I did not find it.
My questions:
1. I do not understand the syntax of the described sequences, I did not find it in Google, apparently I cannot make a correct request on the topic.
2. I don't understand how to quickly describe the resulting sequence rule. It is obvious that writing the entire truth table for some k and then looking for the pattern with your eyes is not what is expected, given that a minimum of minutes is allotted for the solution.
3. Apparently I don’t quite know something about the properties of XOR in combination with shift and subtraction.
Help, please, to understand the principle of the solution.
PS I do not want to take the test at your expense, the next time the questions will still be different. My task is to study the topic and master the approach.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Fedoryan, 2018-05-23
@VMesser

Gray code , answer 3

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question