World Library  
Flag as Inappropriate
Email this Article

Unary numeral system

Article Id: WHEBN0000032316
Reproduction Date:

Title: Unary numeral system  
Author: World Heritage Encyclopedia
Language: English
Subject: Numeral system, List of numeral systems, Elias gamma coding, P-complete, CC (complexity)
Publisher: World Heritage Encyclopedia

Unary numeral system

The unary numeral system is the bijective base-1 numeral system. It is the simplest numeral system to represent natural numbers:[1] 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.[2]


Addition and subtraction are particularly simple in the unary system, as they involve little more than string concatenation.[3] The Hamming weight or population count operation that counts the number of nonzero bits in a sequence of binary values may also be interpreted as a conversion from unary to binary numbers.[1] Multiplication and division are more cumbersome, however.


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.[4] 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.

In computational complexity theory, unary numbering is used to distinguish strongly NP-complete problems from problems that are NP-complete but not strongly NP-complete. A problem in which the input includes some numerical parameters is strongly NP-complete if it remains NP-complete even when the size of the input is made artificially larger by representing the parameters in unary. For such a problem, there exist hard instances for which all parameter values are at most polynomially large.[5]


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.[6]

See also


  1. ^ a b Blaxell, David (1978), "Record linkage by bit pattern matching", in Hogben, David; Fife, Dennis W., Computer Science and Statistics--Tenth Annual Symposium on the Interface, NBS Special Publication 503, U.S. Department of Commerce / National Bureau of Standards, pp. 146–156 .
  2. ^ Woodruff, Charles E. (1909), "The evolution of modern numerals from ancient tally marks",  .
  3. ^ Sazonov, Vladimir Yu. (1995), "On feasible numbers", Logic and computational complexity (Indianapolis, IN, 1994), Lecture Notes in Comput. Sci. 960, Springer, Berlin, pp. 30–51,  . See in particular p.  48.
  4. ^  .
  5. ^  .
  6. ^  .

External links

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.