Unary numeral system

From Wikipedia, the free encyclopedia
Jump to: navigation, search

The unary numeral system is the bijective base-1 numeral system. It is the simplest numeral system to represent natural numbers: in order to represent a number N, an arbitrarily chosen symbol representing 1 is repeated N times.

This system is used in tallying. For example, using the tally mark |, the number 6 is represented as ||||||. In East Asian cultures, the number three is represented as “三”, a character that is drawn with three strokes.


Addition and subtraction are particularly simple in the unary system, as they involve little more than string concatenation. Multiplication and division are more cumbersome, however.


For a real example of the unary system in ancient mathematics, see the Moscow Mathematical Papyrus, dating from circa 1800 BC.

In some cultures it is traditional to decorate a birthday cake using the unary system with candles to represent age. This exploits the unique property of the system that there is no requirement for any ordering of the symbols (that is, the age can be read from the candles regardless of how they are arranged on the cake).

Unary is used as part of some data compression algorithms such as Golomb coding. Compared to standard positional numeral systems, the unary system is inconvenient and is not used in practice for large calculations. It occurs in some decision problem descriptions in theoretical computer science (e.g. some P-complete problems), where it is used to "artificially" decrease the run-time or space requirements of a problem. For instance, the problem of integer factorization is suspected to require more than a polynomial function of the length of the input as run-time if the input is given in binary, but it only needs linear runtime if the input is presented in unary. But this is potentially misleading: using a unary input is slower for any given number, not faster; the distinction is that a binary (or larger base) input is proportional to the base 2 (or larger base) logarithm of the number while unary input is proportional to the number itself; so while the run-time and space requirement in unary looks better as function of the input size, it is a worse function of the number that the input represents.

See also[edit]


External links[edit]