33
$\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$
  • $\begingroup$ 1-1 or 11-11 or 111-111, etc $\endgroup$ – Yuriy S Feb 23 '17 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 Feb 23 '17 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$ – Euro Micelli Feb 24 '17 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 Feb 24 '17 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 Feb 24 '17 at 7:48

10 Answers 10

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$
  • 7
    $\begingroup$ Any complete use of unary has head-tail marking or list-separator marking, which completes this answer. $\endgroup$ – Joshua Feb 23 '17 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 Feb 24 '17 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 Feb 24 '17 at 7:42
  • $\begingroup$ Surely you could have defined it as well so that zero is | and one is ||, and so on $\endgroup$ – theonlygusti Feb 24 '17 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 Feb 25 '17 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$
  • 11
    $\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$ – goblin Feb 23 '17 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 Feb 23 '17 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$ – Aalok Feb 23 '17 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 Feb 23 '17 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$ – ClassicEndingMusic Feb 24 '17 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$
  • $\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$ – Aalok Feb 24 '17 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$ – Ilya Feb 24 '17 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$ – goblin Feb 24 '17 at 16:37
  • $\begingroup$ You're correct on that point $\endgroup$ – Ilya Feb 24 '17 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$ – goblin Feb 24 '17 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$
  • $\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 Feb 24 '17 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$
  • $\begingroup$ Ps. I'm new to this website. If you downvote my answer please leave a comment WHY you have downvoted it. Thanks. $\endgroup$ – Martin Rosenau Feb 25 '17 at 7:44
  • $\begingroup$ +1 Your answer really gives a hint about what representing numbers is. $\endgroup$ – Josi Mar 21 '17 at 20:13
0
$\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$
  • $\begingroup$ This book was written by J. de Velasco, a high school teacher in Salamanca, Spain. $\endgroup$ – Josi Mar 21 '17 at 20:15
-1
$\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$
  • $\begingroup$ What about -1? The OP uses the "-" sign $\endgroup$ – Yuriy S Feb 25 '17 at 9:12
  • $\begingroup$ I would just color them red. Fewer symbols that way. ;) $\endgroup$ – Paul Chernoch Feb 25 '17 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.