Non-adjacent form

The non-adjacent form (NAF) of a number is a unique signed-digit representation, in which non-zero values cannot be adjacent. For example:

(0 1 1 1)2 = 4 + 2 + 1 = 7
(1 0 −1 1)2 = 8 − 2 + 1 = 7
(1 −1 1 1)2 = 8 − 4 + 2 + 1 = 7
(1 0 0 −1)2 = 8 − 1 = 7

All are valid signed-digit representations of 7, but only the final representation, (1 0 0 −1)2, is in non-adjacent form.

The non-adjacent form is also known as "canonical signed digit" representation.


© MMXXIII Rich X Search. We shall prevail. All rights reserved. Rich X Search