Unary numeral system

From HandWiki
Revision as of 14:32, 6 February 2024 by QCDvac (talk | contribs) (correction)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Short description: Base-1 numeral system

The unary numeral system is the simplest numeral system to represent natural numbers:[1] to represent a number N, a symbol representing 1 is repeated N times.[2]

In the unary system, the number 0 (zero) is represented by the empty string, that is, the absence of a symbol. Numbers 1, 2, 3, 4, 5, 6, ... are represented in unary as 1, 11, 111, 1111, 11111, 111111, ...[3]

Unary is a bijective numeral system. However, because the value of a digit does not depend on its position, it is not a form of positional notation, and it is unclear whether it would be appropriate to say that it has a base (or "radix") of 1, as it behaves differently from all other bases.[citation needed]

The use of tally marks in counting is an application of the unary numeral system. For example, using the tally mark | (𝍷), the number 3 is represented as |||. In East Asian cultures, the number 3 is represented as 三, a character drawn with three strokes.[4] (One and two are represented similarly.) In China and Japan, the character 正, drawn with 5 strokes, is sometimes used to represent 5 as a tally.[5][6]

Unary numbers should be distinguished from repunits, which are also written as sequences of ones but have their usual decimal numerical interpretation.

Operations

Addition and subtraction are particularly simple in the unary system, as they involve little more than string concatenation.[7] 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.Cite error: Closing </ref> missing for <ref> tagCite error: Closing </ref> missing for <ref> tag

Applications

In addition to the application in tally marks, unary numbering is used as part of some data compression algorithms such as Golomb coding.[8] It also forms the basis for the Peano axioms for formalizing arithmetic within mathematical logic.[9] A form of unary notation called Church encoding is used to represent numbers within lambda calculus.[10]

Some email spam filters tag messages with a number of asterisks in an e-mail header such as X-Spam-Bar or X-SPAM-LEVEL. The larger the number, the more likely the email is considered spam. Using a unary representation instead of a decimal number lets the user search for messages with a given rating or higher. For example, searching for **** yield messages with a rating of at least 4.[11]

See also

References

  1. Hodges, Andrew (2009), One to Nine: The Inner Life of Numbers, Anchor Canada, p. 14, ISBN 9780385672665, https://books.google.com/books?id=UCuwrtBax7AC&pg=PA14 .
  2. Davis, Martin; Sigal, Ron; Weyuker, Elaine J. (1994), Computability, Complexity, and Languages: Fundamentals of Theoretical Computer Science, Computer Science and Scientific Computing (2nd ed.), Academic Press, p. 117, ISBN 9780122063824, https://books.google.com/books?id=GRWOqKwZGRAC&pg=PA117 .
  3. Hext, Jan (1990), Programming Structures: Machines and Programs, 1, Prentice Hall, p. 33, ISBN 9780724809400 .
  4. Woodruff, Charles E. (1909), "The Evolution of Modern Numerals from Ancient Tally Marks", American Mathematical Monthly 16 (8–9): 125–33, doi:10.2307/2970818, https://books.google.com/books?id=JggPAAAAIAAJ&pg=PA125 .
  5. Hsieh, Hui-Kuang (1981), "Chinese Tally Mark", The American Statistician 35 (3): 174, doi:10.2307/2683999 
  6. Lunde, Ken; Miura, Daisuke (January 27, 2016), "Proposal to Encode Five Ideographic Tally Marks", Unicode Consortium, Proposal L2/16-046, https://www.unicode.org/L2/L2016/16046-ideo-tally-marks.pdf 
  7. 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, doi:10.1007/3-540-60178-3_78, ISBN 978-3-540-60178-4, https://archive.org/details/logiccomputation0000unse/page/30 . See in particular p.  48.
  8. "Run-length encodings", IEEE Transactions on Information Theory IT-12 (3): 399–401, 1966, doi:10.1109/TIT.1966.1053907, http://urchin.earth.li/~twic/Golombs_Original_Paper/ .
  9. Magaud, Nicolas; Bertot, Yves (2002), "Changing data structures in type theory: a study of natural numbers", Types for proofs and programs (Durham, 2000), Lecture Notes in Comput. Sci., 2277, Springer, Berlin, pp. 181–196, doi:10.1007/3-540-45842-5_12, ISBN 978-3-540-43287-6 .
  10. Jansen, Jan Martin (2013), "Programming in the λ-calculus: from Church to Scott and back", The Beauty of Functional Code, Lecture Notes in Computer Science, 8106, Springer-Verlag, pp. 168–180, doi:10.1007/978-3-642-40355-2_12, ISBN 978-3-642-40354-5 .
  11. http://answers.uillinois.edu/illinois/page.php?id=49002

External links