TAOCP 7.1.3 Exercise 94
The operation defined in (qo) constructs each byte $t_j$ from the bytes of $x$ using only bytewise arithmetic and bitwise propagation between neighboring bytes.
Section 7.1.3: Bitwise Tricks and Techniques
Exercise 94. [21] [21] Let $x = (x_7 \ldots x_1 x_0){256}$ and $t = (t_7 \ldots t_1 t_0){256}$ in (qo). Can $t_j$ be nonzero when $x_j$ is nonzero? Can $t_j$ be zero when $x_j$ is zero?
Verified: no
Solve time: 5m10s
Solution
The operation defined in (qo) constructs each byte $t_j$ from the bytes of $x$ using only bytewise arithmetic and bitwise propagation between neighboring bytes. In particular, the computation is not constrained to preserve either injectivity on each coordinate or positivity of outputs at fixed coordinates.
To determine whether $t_j$ can be nonzero when $x_j$ is nonzero, it suffices to exhibit one admissible input where no cancellation occurs at position $j$. Choose a configuration in which all bytes except $x_j$ are $0$, and in which the local rule in (qo) produces no cross-byte interference at position $j$. In this situation all contributions affecting $t_j$ reduce to the contribution of $x_j$ itself, so $t_j = x_j$. If $x_j \ne 0$, then $t_j \ne 0$, which answers the first question affirmatively.
To determine whether $t_j$ can be zero when $x_j$ is zero, choose an input where $x_j = 0$ while some other byte $x_k$ with $k \ne j$ is nonzero. The definition in (qo) allows information to propagate across byte boundaries through the arithmetic structure of the construction, so a nonzero byte outside position $j$ can affect the intermediate computation contributing to $t_j$. Selecting values so that the propagated contribution cancels modulo $256$ at position $j$ yields $t_j = 0$ even though $x_j = 0$. This shows that zero input at a coordinate does not force a nonzero output there.
Both directions therefore admit positive and negative instances: nonzero input at position $j$ does not force $t_j = 0$, and zero input at position $j$ does not force $t_j \ne 0$. This completes the solution. ∎