HOME

TheInfoList



OR:

An addition-subtraction chain, a generalization of
addition chain In mathematics, an addition chain for computing a positive integer can be given by a sequence of natural numbers starting with 1 and ending with , such that each number in the sequence is the sum of two previous numbers. The ''length'' of an addit ...
s to include subtraction, is a
sequence In mathematics, a sequence is an enumerated collection of objects in which repetitions are allowed and order matters. Like a set, it contains members (also called ''elements'', or ''terms''). The number of elements (possibly infinite) is called ...
''a''0, ''a''1, ''a''2, ''a''3, ... that satisfies :a_0 = 1, \, :\textk > 0,\ a_k = a_i \pm a_j\text0 \leq i,j < k. An addition-subtraction chain for ''n'', of length ''L'', is an addition-subtraction chain such that a_L = n. That is, one can thereby compute ''n'' by ''L'' additions and/or subtractions. (Note that ''n'' need not be positive. In this case, one may also include ''a''−1 = 0 in the sequence, so that ''n'' = −1 can be obtained by a chain of length 1.) By definition, every addition chain is also an addition-subtraction chain, but not vice versa. Therefore, the length of the ''shortest'' addition-subtraction chain for ''n'' is bounded above by the length of the shortest addition chain for ''n''. In general, however, the determination of a minimal addition-subtraction chain (like the problem of determining a minimum addition chain) is a difficult problem for which no efficient algorithms are currently known. The related problem of finding an optimal addition sequence is
NP-complete In computational complexity theory, a problem is NP-complete when: # it is a problem for which the correctness of each solution can be verified quickly (namely, in polynomial time) and a brute-force search algorithm can find a solution by tryin ...
(Downey et al., 1981), but it is not known for certain whether finding optimal addition or addition-subtraction chains is
NP-hard In computational complexity theory, NP-hardness ( non-deterministic polynomial-time hardness) is the defining property of a class of problems that are informally "at least as hard as the hardest problems in NP". A simple example of an NP-hard pr ...
. For example, one addition-subtraction chain is: a_0=1, a_1=2=1+1, a_2=4=2+2, a_3=3=4-1. This is not a ''minimal'' addition-subtraction chain for ''n''=3, however, because we could instead have chosen a_2=3=2+1. The smallest ''n'' for which an addition-subtraction chain is shorter than the minimal addition chain is ''n''=31, which can be computed in only 6 additions (rather than 7 for the minimal addition chain): :a_0=1,\ a_1=2=1+1,\ a_2=4=2+2,\ a_3=8=4+4,\ a_4=16=8+8,\ a_5=32=16+16,\ a_6=31=32-1. Like an addition chain, an addition-subtraction chain can be used for
addition-chain exponentiation In mathematics and computer science, optimal addition-chain exponentiation is a method of exponentiation by a positive integer power that requires a minimal number of multiplications. Using ''the form of'' the shortest addition chain, with multipl ...
: given the addition-subtraction chain of length ''L'' for ''n'', the power x^n can be computed by multiplying or dividing by ''x'' ''L'' times, where the subtractions correspond to divisions. This is potentially efficient in problems where division is an inexpensive operation, most notably for exponentiation on
elliptic curve In mathematics, an elliptic curve is a smooth, projective, algebraic curve of genus one, on which there is a specified point . An elliptic curve is defined over a field and describes points in , the Cartesian product of with itself. If ...
s where division corresponds to a mere sign change (as proposed by Morain and Olivos, 1990). Some
hardware multiplier A binary multiplier is an electronic circuit used in digital electronics, such as a computer, to multiply two binary numbers. A variety of computer arithmetic techniques can be used to implement a digital multiplier. Most techniques involve com ...
s multiply by ''n'' using an addition chain described by n in binary: n = 31 = 0 0 0 1 1 1 1 1 (binary). Other hardware multipliers multiply by ''n'' using an addition-subtraction chain described by n in
Booth encoding Booth's multiplication algorithm is a multiplication algorithm that multiplies two signed binary numbers in two's complement notation. The algorithm was invented by Andrew Donald Booth in 1950 while doing research on crystallography at Birkbeck ...
: n = 31 = 0 0 1 0 0 0 0 −1 (Booth encoding).


References

* * * * {{Cite OEIS, 1=A128998, 2=length of minimum addition-subtraction chain Addition chains