Calculating an addition chain of minimal length is not easy; a generalized version of the problem, in which one must find a chain that simultaneously forms each of a sequence of values, is
NP-complete. There is no known algorithm which can calculate a minimal addition chain for a given number with any guarantees of reasonable timing or small memory usage. However, several techniques are known to calculate relatively short chains that are not always optimal. One very well known technique to calculate relatively short addition chains is the
binary method, similar to
exponentiation by squaring. In this method, an addition chain for the number n is obtained recursively, from an addition chain for n'=\lfloor n/2\rfloor. If n is even, it can be obtained in a single additional sum, as n=n'+n'. If n is odd, this method uses two sums to obtain it, by computing n-1=n'+n' and then adding one. The
factor method for finding addition chains is based on the
prime factorization of the number n to be represented. If n has a number p as one of its prime factors, then an addition chain for n can be obtained by starting with a chain for n/p, and then concatenating onto it a chain for p, modified by multiplying each of its numbers by n/p. The ideas of the factor method and binary method can be combined into ''Brauer's m-ary method
by choosing any number m (regardless of whether it divides n), recursively constructing a chain for \lfloor n/m\rfloor, concatenating a chain for m (modified in the same way as above) to obtain m\lfloor n/m\rfloor, and then adding the remainder. Additional refinements of these ideas lead to a family of methods called sliding window methods''. ==Chain length==