36
$\begingroup$
  • In the decimal system: $...-3, -2, -1, 0, 1, 2, 3...$
  • In the binary system: $...-11, -10, -1, 0, 1, 10, 11...$
  • In the unary system: $-111, -11, -1, \text{ ??? }, 1, 11, 111...$

I was only able to find a related question but none with an answer so far:

unary numbers: base-1 numeral system

$\endgroup$
5
  • 2
    $\begingroup$ 1-1 or 11-11 or 111-111, etc $\endgroup$
    – Yuriy S
    Commented Feb 23, 2017 at 13:58
  • 11
    $\begingroup$ If you have a definition, use it; if not, make it up. The definition of unary is of so little mathematical importance that I doubt you will find a meaningful consensus. I agree with the suggestion of using “$0$”, or even –not suggested yet as I write– “$-$”. $\endgroup$
    – PJTraill
    Commented Feb 23, 2017 at 21:15
  • 1
    $\begingroup$ The unary system described by you is not a valid "positional number system" (which is what decimal and binary are). A blank is probably the most reasonable choice, but don't feel taken back by the difference in approach. $\endgroup$ Commented Feb 24, 2017 at 6:24
  • $\begingroup$ Note that in $x$-al system you have $x$-its from $0$ to largest integer less than $x$. This makes your proposed unary system quite odd. $\endgroup$
    – skyking
    Commented Feb 24, 2017 at 7:40
  • $\begingroup$ @skyking: It's definitely not a base-$1$ system, but conventionally it's called "unary" anyway. Many textbooks on Turing machines also use this unary representation for ease of exposition, but necessarily the tape must support at least two 'symbols' (each cell can be blank or non-blank), for pretty much the reason explained in my answer. $\endgroup$
    – user21820
    Commented Feb 24, 2017 at 7:48

11 Answers 11

60
$\begingroup$

You do something like this:

Sneaky, no?

"Unary" is just a tally-mark system, not a really full-fledged numeral system. You represent Zero by not representing any quantity at all.

One Apple: |

Two Apples: ||

No Apples:

And that's basically it. Putting any other symbol on the system to represent a Zero makes it a binary system.


In the comments, Joshua talks about head-tail delimiters for unary systems. You can use head-tail delimiters to make the zero-quantity evident or to separate groups of numbers.

For example, one could write "||", "|||", and "" to represent 2, 3 and 0. In this case, the quotes aren't part of the numbers but they help us visualize where the number starts or ends and they make the 0-value visible.

Keep in mind that "unary" isn't really a numeral system with the same representative capabilities of binary, hex, etc. For it to be used properly as a mathematical tool you end up needing to hack it a bit adding some other symbols. At that point you can just use something else that can represent your problem on a more practical way.

$\endgroup$
18
  • 7
    $\begingroup$ Any complete use of unary has head-tail marking or list-separator marking, which completes this answer. $\endgroup$
    – Joshua
    Commented Feb 23, 2017 at 16:18
  • 22
    $\begingroup$ Before I finished reading the whole text I was wondering why the spoiler quote wasn't working! $\endgroup$
    – Fine Man
    Commented Feb 24, 2017 at 2:28
  • $\begingroup$ As I state in my answer, putting a tally mark and not putting a tally mark are essentially two symbols, and there is no truly unary system. $\endgroup$
    – user21820
    Commented Feb 24, 2017 at 7:42
  • $\begingroup$ Surely you could have defined it as well so that zero is | and one is ||, and so on $\endgroup$
    – minseong
    Commented Feb 24, 2017 at 8:04
  • 2
    $\begingroup$ Empty symbol is also a symbol ( if put in an appropriate place), so in fact your proposition is binary. $\endgroup$
    – Widawensen
    Commented Feb 25, 2017 at 9:04
22
$\begingroup$

In fact, there is no "unary" number system that is the analog of fixed-radix systems (e.g., base $2$, base $10$, etc). A radix, by definition, is a number greater than $1$.

Your "unary" system is really nothing more than tally marks. So zero would be represented by the absence of any symbol. These are really strings, not numbers. You can't add them using column addition. So you really have

$$-3_{10} = “-111_1”$$ $$-2_{10} = “-11_1”$$ $$-1_{10} = “-1_1”$$ $$0_{10} = “”$$ $$1_{10} = “1_1”$$ $$2_{10} = “11_1”$$ $$3_{10} = “111_1”$$

$\endgroup$
12
  • 13
    $\begingroup$ "There is no unary number system" - that is so true! a unary number system would only use $0$'s after all, e.g. $$000 = 0\cdot 1^2+0\cdot 1^1+0\cdot 1^0 = 0$$ $\endgroup$ Commented Feb 23, 2017 at 15:21
  • 5
    $\begingroup$ And goblin's comment explains (in my opinion) why the radix of a standard base-$n$ system must be greater than $1.$ This may be presented as a definition, but it's not an arbitrary definition. $\endgroup$
    – David K
    Commented Feb 23, 2017 at 18:13
  • 1
    $\begingroup$ It is indeed possible to define a columnar addition even in a hypothetical unary system (which is essentially a concatenation string). Here's what you do: take a carry over symbol each time you have to add two symbols and not down the base number of this system, which is essentially the symbol you have chosen. E.g. when adding | to ||, you would first add | and |, to get an overflow in youe base, then jot down the base symbol which is | and carry | ahead. In this manner you obtain ||| which is, as expected, |+||. $\endgroup$
    – axolotl
    Commented Feb 23, 2017 at 19:10
  • 1
    $\begingroup$ @zakoda : That's not column addition. Column addition results in a single digit with a carry. It doesn't work the same way. Yes, you can pretend it's column addition with weird rules that don't apply with any other base, but it really isn't. In the end, you're just counting all the tally marks in every addend -- not column addition. $\endgroup$
    – MPW
    Commented Feb 23, 2017 at 22:15
  • 1
    $\begingroup$ Wouldn't it be possible to define an unary system by shifting, so that $1$ and $-1$ represent $0$, and $11$ represent $1$, $-1111$ represent $-3$ and so on? $\endgroup$ Commented Feb 24, 2017 at 0:06
9
$\begingroup$

The "unary" system is more closely related to Roman Numerals than to the decimal or binary system.

In every "$n$-ary" such as binary, ternary, octal, decimal, hexadecimal, and so forth, the digits are $0, 1, \ldots, n-1.$ If we applied that rule to unary, since $n-1 = 0$ the only digit would be $0$ itself, and zero would be the only number that could be written.

To construct a real "base $1$" system according to the same general principals as other base-$n$ systems is not useful. Therefore someone decided to use the name "unary" for the tally-mark system instead, that is, since it can only have one digit the digit would be $1$ and not $0.$ Not surprisingly, this number system cannot do everything that all the "regular" base-$n$ systems can do.

$\endgroup$
8
$\begingroup$

This is more like a long comment.

In some sense, we actually denote $0$ "incorrectly" in the binary and decimal systems. Let me explain.

For each natural number $n$, define a function $$\#_n : \mathbb{N}^n \rightarrow \mathbb{N}$$ as follows:

$$\#_n(a) = \sum_{i=0}^{n-1} a_i 10^i$$

For example, we can think of $487$ as shorthand for the more formal $\#_3(7,8,4)$. The relevant "computation" in all its glorious details:

$$\#_3(7,8,4) = (7,8,4)_0 10^0+(7,8,4)_1 10^1+(7,8,4)_2 10^2 = 7 \cdot 10^0+8\cdot 10^1 +4 \cdot 10^2 = 487$$

Okay, lets now ask ourselves: what are the rules for normal forms? Surely a necessary condition for being a normal form is not having any $0$'s on the right, since they're redundant:

$$\#_{n+1}(a,0)= \sum_{i=0}^{n} (a,0)_i 10^i = (a,0)_n+\sum_{i=0}^{n-1} (a,0)_i 10^i = 0+\sum_{i=0}^{n-1} a_i 10^i = \#_n(a)$$

This suggests that $0$ is not in normal form, because that's really shorthand for $\#_1(0),$ which, due to the presence of redundant zeroes, isn't in normal form. The normal form for $0$ is actually $\#_0().$

Though honestly, I'm not too fussed :)

By the way, this kind of notation is actually pretty useful for doing computations. For example, suppose we're trying to find $67+58$. We can write something like this:

$$67+58 = [6,7]+[5,8] = [11,15] = [12,5] = [1,2,5] = 125$$

This is very similar to the high school method of writing the two numbers one above the other, and doing a sum for each column while "carrying" the overflow to the next column.

$\endgroup$
6
  • $\begingroup$ @MPW with reference to my comment on your answer, please also consider the way columnar addition is represented here. I think this is consistent with what I am trying to say. $\endgroup$
    – axolotl
    Commented Feb 24, 2017 at 5:20
  • $\begingroup$ If I follow your answer: you define a collection of functions $\#_n$, and then out of a sudden: "what are the rules for normal forms?" which follows by "Surely a necessary condition". First, it does not seem that you've defined what a normal form is in this particular context, which makes it hard to say what are the obvious statements about them. Second, $\#_0()$ seems undefined, as by definition of $\#_0$ it must call a zeroth element of its argument, and empty argument does not seem to have any elements at all. $\endgroup$
    – SBF
    Commented Feb 24, 2017 at 11:54
  • $\begingroup$ @Ilya, note that $\#_0 : \mathbb{R}^0 \rightarrow \mathbb{R},$ so a $0$-long list of inputs is actually correct. $\endgroup$ Commented Feb 24, 2017 at 16:37
  • $\begingroup$ You're correct on that point $\endgroup$
    – SBF
    Commented Feb 24, 2017 at 16:38
  • $\begingroup$ @Ilya, regarding normal forms, I don't actually know how to specify normal forms; my training is in classical set-theory, which mostly ignores computational issues. I guess to do it properly, I'd have to change the domain and codomain of the hash function(s) to $\mathbb{N}^n \rightarrow \mathbb{N}$, and then assert that an expression involving these functions, and only these functions, is in normal form iff firstly, there's no $0$'s on the right, and secondly, it's been completely "denested" so that e.g. $\#_2(\#_2(2,3),9)) = \#_2(2,2,1)$. Something like that. Like I said, I don't know how... $\endgroup$ Commented Feb 24, 2017 at 16:42
4
$\begingroup$

While I can see the argument that zero in unary 'should be' represented by "" (i.e nothing there), I would counter-argue that zero should be represented the same way in any other number system - i.e by "0" - with the proviso that one must have -either- that symbol -or- tally-marks, never both in the same expression. The entire point of introducing the special symbol "0" is to be able to visually indicate the presence of an absence (a rather paradoxical notion, actually).

$\endgroup$
2
$\begingroup$

I feel it is important to point out that there is no true unary system, in the sense that there needs to be some way of determining where a notation ends, and so that blank space or whatever else is used to indicate termination is actually functioning as a second symbol! This is very obvious if you think about how you could transmit arbitrarily large natural numbers to another person, such that the recipient knows when you are done transmitting. Informally, you cannot just use a fixed piece of paper or fixed length of time or fixed number of signals, since any bounded notation will only be able to represent a finite number of numbers. More formally, whatever medium you use must have at least two states, because if it only has one state then it cannot convey a single bit of information!

As others have pointed out, unary is just like tally marks, but it is wrong to assume that it uses only one symbol. When you read the tally marks, you stop when you reach a blank space, so actually there are two symbols, namely the tally mark and the blank space!

Explicitly (with "|" denoting each tally mark and "□" denoting the first blank space):

$3 \mapsto$ |||□

$2 \mapsto$ ||□

$1 \mapsto$ |□

$0 \mapsto$

As you can see, the actual fact is that unary uses two symbols and is very inefficient. A natural next question is then whether binary in fact requires three symbols. Using the standard binary encoding, yes we need a termination symbol as before.

However, there are binary prefix-free codes that can easily encode arbitrarily large natural numbers such that you know when the notation terminates without needing a third symbol. One basic method is to use unary (since we have two symbols) to encode the length of the binary representation, and then put the binary representation after that:

$3 \mapsto$ 11011

$2 \mapsto$ 11010

$1 \mapsto$ 101

$0 \mapsto$ 0

Note that we can save a bit by dropping the "1" in front of the binary representation (except for $0$). And if you think using unary at the start is wasteful, you can recursively apply this strategy one or more times, yielding one of the many universal codes.

$\endgroup$
1
  • $\begingroup$ Different perspective on the same thing: Truly single-symbol unary doesn't typecheck. (If succ : X, you can't actually form successors; if succ : X -> X, you lack the base case – there might be one infinite "number" if your universe permits, or else none at all.) $\endgroup$
    – nobody
    Commented Feb 24, 2017 at 9:25
1
$\begingroup$

The notion of zero is a relatively recent one - see History of Zero . There is no zero in unary.

See Unary numeral system

$\endgroup$
1
$\begingroup$

To understand the problem in the "unary" system we have a look on the ternary system first. Normally numeral systems use digits $\{0, 1, ... (N-1)\}$ so the terneray system uses the digits $\{0, 1, 2\}$.

However there is the so-called "symmetric" ternary system which has been used for some computers in the 1960s. This system used the digits $\{-1, 0, 1\}$ instead.

You might also define that "your" ternary system uses the digits $\{1, 2, 3\}$ instead of $\{0, 1, 2\}$ (although this makes no sense). Doing so would allow you to write any positive integer - but not the number zero. Here the numbers from 12 (decimal) to 1 (downwards) in that system:

... 33, 32, 31, 23, 22, 21, 13, 12, 11, 3, 2, 1, (can't write 0!)

By defining an "unary system" using the digit $1$ (instead of $0$) this is what you are doing!

Just like in the non-standard ternary system using digits $\{1, 2, 3\}$ you can write any positive integer but not the number zero.

Using the "normal" "unary system" would allow you to write the number zero - but no other numbers.

$\endgroup$
2
  • $\begingroup$ Ps. I'm new to this website. If you downvote my answer please leave a comment WHY you have downvoted it. Thanks. $\endgroup$ Commented Feb 25, 2017 at 7:44
  • $\begingroup$ +1 Your answer really gives a hint about what representing numbers is. $\endgroup$
    – Josi
    Commented Mar 21, 2017 at 20:13
1
$\begingroup$

I was in Spain a couple of weeks ago, more precisely in Salamanca, which as you know has one of the oldest universities in Europe. I always take advantage of my travels to search for old books of mathematics. In this case, in a quite small old library close to the cathedral I found a book of mids XIX century. As I am not proficient in Spanish, with the help of a friend I translated the part talking about number representation.

The author talked about an ancient Moorish way of representing natural numbers in a decimal system, using a special symbol for 10. He uses the letter “D” to do so, in part because it is like a “1” and a “0” put together, in part because “D” is the beginning of “Diez” (ten in Spanish) – and I guess many ancient typesets lacked special symbols.

So I found curious the way of representing natural numbers in this decimal system:

1,2,3,….    …, 8, 9, D,
11,12,13…   …, 18,19,1D,
21,22,23…   …, 28,29,2D,
…
91,92,93…   …, 98,99,9D
D1,D2,D3…   …, D8,D9,DD
111,112,113…

This is a valid representation of all natural quantities, because there is one and only one representation for every quantity. For instance,

(4D8)D = (508)10
(DDD)D= (1110)10

The numbers not containing any "D" represent exactly the same quantity in both systems.

This author pointed out that this was the way that numbers were written anciently in a decimal system before the introduction of the “0” for representing quantities. He did not describe any historical facts -he talks about the Moors but maybe he was wrong-, but thinking about the way Egyptians used to represent numbers in a decimal system, they had special symbols for powers of 10, but the symbol for Zero (nfr) was never used as a symbol to write other numbers. So the author’s explanation makes sense.

Then I understood that one thing is having a symbol for Zero for operations and another thing is using that symbol to represent numbers. The question is,

If Zero is not a natural number, why do we introduce it inside the representation of them? If we have the set of natural numbers, and we want to have a decimal representation, in a pure natural representation we should not introduce an element we do not have. So for example, lets accept that we have powers of ten represented as Di. Then

(703)10 = 7 x D² + 0 (???) x D + 3 * 1

What is that ‘0’ element?

Then, extending this way of representing numbers to other systems, we have for example:

Octal: 1,2,3,4,5,6,7,8,11,12,13,14,15,16,17,18,21,22…
Binary: 1,2,11,12,21,22,111,112,121,122,211,212,221,222…
Unary: 1,11,111,1111,1111…

The conclusion is: The unary system is totally valid.

And as a side advantage, with this system we use less digits. For instance, with the normal binary system we can count up to (111)2= 7, while with this other binary system we can count up to (222)2= 14.

Of course there are advantages of using the Zero for representing natural numbers, but this led us to a confusion, making some people think -as we could see in some answers- that the unary system was not a valid system, or that Zero could be represented as a blank. It is indeed a valid system, and for sure the most ancient -at least it has been proved to be 20000 years old. And the answer to this question is that Zero in the unary system is the same as in any other system, something introduced not for representing quantities but as an element of more complex mathematics -as in algebraic structures like groups or rings, or in set theory, as the cardinality of the empty set.

$\endgroup$
1
  • $\begingroup$ This book was written by J. de Velasco, a high school teacher in Salamanca, Spain. $\endgroup$
    – Josi
    Commented Mar 21, 2017 at 20:15
0
$\begingroup$

Simple:

0 = 1
1 = 11
2 = 111
3 = 1111

Just have every number use one more tally mark than its value. As a programmer, I would call this zero-based unary.

$\endgroup$
4
  • $\begingroup$ What about -1? The OP uses the "-" sign $\endgroup$
    – Yuriy S
    Commented Feb 25, 2017 at 9:12
  • $\begingroup$ I would just color them red. Fewer symbols that way. ;) $\endgroup$ Commented Feb 25, 2017 at 16:37
  • $\begingroup$ This solution is not crazy because the number are a set of symbols that uniquelly represents values. $\endgroup$ Commented Feb 19, 2021 at 22:46
  • $\begingroup$ In case of empty or null be the correct form, base(10) or b(5) systems had to represent the 0 as using null. $\endgroup$ Commented Feb 19, 2021 at 22:47
-1
$\begingroup$

@user21820 and @paul-chernoch I know, it's very old thread, but your solutions are the same as mine, and I am happy that someone thought like me. Zero-based unary - very nice name for this solution. I called this solution box-based, why??? As @user21829 wrote: 3↦|||□ 2↦||□ 1↦|□ 0↦□ If we have boxes, we can put any amount of something in them. In unary usually we put 1 thing in each box, but we can put 5 or 10, than count all of boxes and multiply by number of boxes. We also have a lot of empty boxes, which we can use, why don't use it in last (place of ones) place??? This way we can modify @user21829 solution and write all numbers like in decimal:

A↦(1) - box with $1$

A↦(1) - box with $1$

A↦(1) - box with $1$

A↦(0) - empty box

$$(AAAA)1 = 1+1+1+0 = 3.$$

In this way, I wrote a program that can convert numbers to mononomial and polynomial numbering systems. The unary system was a big challenge for me, but I succeeded. The program also performs basic calculations on numbers up to $2147483647$ digits without rounding.

MikiCalculator

$\endgroup$
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .