Template:Noble Boolean functions/Python half rows

There are two ways to derive one half from the other.

Let $$L$$ be the left (evil) and $$R$$ be the right (odious) half. Let $$p = 2^{(2^n-1)}$$ be the unique power of two, and $$q = 2^{2^n} - 2$$ be the highest entry. (They are the first and last entries of $$R$$.) Let $$j$$ be the mirrored index of $$i$$. ($$j$$ is as far from the right as $$i$$ is from the left.)

Then $$R_i ~=~ L_i + p ~=~ q - L_j$$. ( can be used instead of plus and minus.)

The following Python code illustrates this for rows 1 to 3: