Can moving eight bits work out the cost of four £13 match tickets?
You’re buying four match tickets at thirteen pounds each. Could you work out the total by sliding the bits that represent thirteen? The trick is knowing which way to move them and what to do with any bits that slide off the edge.
From the right, the places are worth one, two, four, eight and so on. Add the first two patterns from the right. One plus one makes two, so write zero and carry one. Repeat in the next column. Add the third pattern to the sum. Eight plus four plus one gives thirteen.
Start with the eight bits for thirteen. Slide them one place left, drop the bit that leaves on the left, and fill the gap on the right with zero. Do that once more. That’s a logical left shift by two places.
Try it on a different eight-bit pattern. Shift zero zero zero one zero one one zero two places to the left. Fill the empty places with zeros, then pick the resulting eight bits.
Now take thirteen and slide its bits one place right. A zero fills the left end, and the final one drops off. The new value is six. That’s the whole-number result of dividing thirteen by two: six, with a remainder of one that you discard.
Start with the eight-bit pattern for fifty-five. Shift right once, filling the left gap with zero, to get twenty-seven. Repeat to get thirteen. You can check by dividing by four: fifty-five is four times thirteen plus three. The shift gives you thirteen and discards the remainder of three.
Now shift zero zero one zero zero one one zero two places to the right. You can move one place at a time if that helps. Pick the final eight-bit pattern.
Start with thirteen. Only zeros leave, and each one moves to a place worth four times as much. That gives you fifty-two pounds for the tickets. Try the same shift on seventy-seven. A one leaves, so you see fifty-two again, even though four times seventy-seven is three hundred and eight.
Look at the first result. The rightmost one has been put back at the left end, which wrongly adds one hundred and twenty-eight. Now look at the logical right shift. You discard the rightmost one and fill the gap at the left end with zero.
When asked to calculate the result of shifting this pattern two places left, write all eight bits. To explain the effect, say that the value goes from thirty-seven to one hundred and forty-eight. Each one moves to a place worth four times as much, and no ones are lost.