Back to index

Recall that Terras' parity vector is a sequence of 's and 's representing the branches taken by a number during iteration of the function he uses,

At each iteration, the parity vector of a number contains a if the number at this stage is odd (so that the rule is used), or it contains a when the number is even (and the rule applies):

where is the -th iteration of the function . We take , and .

If a number is of the form , with an odd integer and ,

then for , and .

Moreover, .

because the original number is odd. Then the rule is applied, resulting in

which has a form similar to the original , but with one less factor and one more factor .

As long as the exponent of is larger than zero, we will continue having an odd number () and be able to apply again the rule.

After iterations, the exponent of will be consumed, and the number replaced by , which is even because is odd; hence .


Note that a number of the form , with odd, has a binary representation that ends in bits with a value of , followed to the left by a bit with a value of .
(Because the binary representation of will have bits at the end, and then the ending bit of , which is because is odd; adding to toggles these bits.)

This means that the parity vector of coincides (if laid out right-to-left) with the last bits of the binary representation of the number.

Thus we know, for example, that the number ( in binary) will take the branch three times before using the rule, because .