Unary numeral system

(Redirected from Unary Number 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, although it has sometimes been described as "base 1",[4] it differs in some important ways from positional notations, in which the value of a digit depends on its position within a number. For instance, the unary form of a number can be exponentially longer than its representation in other bases.[5]

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

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

Operations

edit

Addition and subtraction are particularly simple in the unary system, as they involve little more than string concatenation.[9] 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.[10] However, multiplication is more cumbersome and has often been used as a test case for the design of Turing machines.[11][12][13]

Complexity

edit

Compared to standard positional numeral systems, the unary system is inconvenient and hence 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.[14] However, 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. Therefore, while the run-time and space requirement in unary looks better as function of the input size, it does not represent a more efficient solution.[15]

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

Applications

edit

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

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

See also

edit

References

edit
  1. ^ Hodges, Andrew (2009), One to Nine: The Inner Life of Numbers, Anchor Canada, p. 14, ISBN 9780385672665.
  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.
  3. ^ Hext, Jan (1990), Programming Structures: Machines and Programs, vol. 1, Prentice Hall, p. 33, ISBN 9780724809400.
  4. ^ Brian Hayes (2001), "Third Base", American Scientist, 89 (6): 490, doi:10.1511/2001.40.3268, archived from the original on 2014-01-11, retrieved 2013-07-28
  5. ^ Zdanowski, Konrad (2022), "On efficiency of notations for natural numbers", Theoretical Computer Science, 915: 1–10, doi:10.1016/j.tcs.2022.02.015, MR 4410388
  6. ^ 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, JSTOR 2970818.
  7. ^ Hsieh, Hui-Kuang (1981), "Chinese Tally Mark", The American Statistician, 35 (3): 174, doi:10.2307/2683999, JSTOR 2683999
  8. ^ Lunde, Ken; Miura, Daisuke (January 27, 2016), "Proposal to Encode Five Ideographic Tally Marks", Unicode Consortium (PDF), Proposal L2/16-046
  9. ^ Sazonov, Vladimir Yu. (1995), "On feasible numbers", Logic and computational complexity (Indianapolis, IN, 1994), Lecture Notes in Comput. Sci., vol. 960, Springer, Berlin, pp. 30–51, doi:10.1007/3-540-60178-3_78, ISBN 978-3-540-60178-4, MR 1449655. See in particular p.  48.
  10. ^ Blaxell, David (1978), "Record linkage by bit pattern matching", in Hogben, David; Fife, Dennis W. (eds.), Computer Science and Statistics--Tenth Annual Symposium on the Interface, NBS Special Publication, vol. 503, U.S. Department of Commerce / National Bureau of Standards, pp. 146–156.
  11. ^ Hopcroft, John E.; Ullman, Jeffrey D. (1979), Introduction to Automata Theory, Languages, and Computation, Addison Wesley, Example 7.7, pp. 158–159, ISBN 978-0-201-02988-8.
  12. ^ Dewdney, A. K. (1989), The New Turing Omnibus: Sixty-Six Excursions in Computer Science, Computer Science Press, p. 209, ISBN 9780805071665.
  13. ^ Rendell, Paul (2015), "5.3 Larger Example TM: Unary Multiplication", Turing Machine Universality of the Game of Life, Emergence, Complexity and Computation, vol. 18, Springer, pp. 83–86, ISBN 9783319198422.
  14. ^ Arora, Sanjeev; Barak, Boaz (2007), "The computational model —and why it doesn't matter" (PDF), Computational Complexity: A Modern Approach (January 2007 draft ed.), Cambridge University Press, §17, pp. 32–33, retrieved May 10, 2017.
  15. ^ Moore, Cristopher; Mertens, Stephan (2011), The Nature of Computation, Oxford University Press, p. 29, ISBN 9780199233212.
  16. ^ Garey, M. R.; Johnson, D. S. (1978), "'Strong' NP-completeness results: Motivation, examples, and implications", Journal of the ACM, 25 (3): 499–508, doi:10.1145/322077.322090, MR 0478747, S2CID 18371269.
  17. ^ Golomb, S.W. (1966), "Run-length encodings", IEEE Transactions on Information Theory, IT-12 (3): 399–401, doi:10.1109/TIT.1966.1053907.
  18. ^ 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., vol. 2277, Springer, Berlin, pp. 181–196, doi:10.1007/3-540-45842-5_12, ISBN 978-3-540-43287-6, MR 2044538.
  19. ^ Jansen, Jan Martin (2013), "Programming in the λ-calculus: from Church to Scott and back", The Beauty of Functional Code, Lecture Notes in Computer Science, vol. 8106, Springer-Verlag, pp. 168–180, doi:10.1007/978-3-642-40355-2_12, ISBN 978-3-642-40354-5.
  20. ^ Email, Spam Control, How to get service for departmental email servers
edit