TOPICS
Search

Ten's Complement


The ten's complement of a positive integer n<10^d, at a fixed width of d decimal digits, is 10^d-n, where d is a positive integer. More generally, the radix complement of a positive integer n<b^d in base b is b^d-n, where b>=2 is an integer. Complement arithmetic permits subtraction to be performed by addition followed by discarding a final carry.

At the same width, the ten's complement is one more than the nines' complement. Thus it can be computed by replacing each decimal digit a by 9-a and adding 1 to the result (Knuth 1998).


See also

Base, Complement, Radix

Explore with Wolfram|Alpha

References

Knuth, D. E. The Art of Computer Programming, Vol. 2: Seminumerical Algorithms, 3rd ed. Reading, MA: Addison-Wesley, 1998.

Cite this as:

Weisstein, Eric W. "Ten's Complement." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/TensComplement.html

Subject classifications