Questions tagged [number-systems]

Representations of numeric values in decimal, binary, octal, hexadecimal, and other bases; one's-complement and two's-complement signed numbers; scientific notation; floating-point numbers in digital computers; history of number systems; nonstandard number systems; algorithms for arithmetic within specific number systems or for conversions between number systems.

Number systems provide systematic ways to write numeric values such as the (base-ten) numbers $289$ or $2.125$. Some questions with this tag involve algorithms for converting base-ten numbers to or from another number system; conversions between other number systems; algorithms to perform arithmetic (addition, subtraction, multiplication, etc.) within a specific number system without converting the operands to base ten; symbols for writing numbers in systems other than base ten; ancient number systems (such as Roman numerals) and the historical development of number systems; and specialized or unusual number systems.

A base-$b$ number system represents an integer as a sequence of digits, each of which is an integer such that $0 \leq d < b$. Ordinary decimal numbers are written in base ten; other well-known bases include binary (base $2$), octal (base $8$), and hexadecimal (base sixteen). Optionally, the base or radix, $b$, may be appended as a subscript. The value of such a numeric representation is

$${\left(d_m d_{m-1} \cdots d_2 d_1 d_0\right)}_b = d_m b^m + d_{m-1} b^{m-1} + \cdots + d_2 b^2 + d_1 b^1 + d_0 b^0.$$

For example, $21_{16} = 33_{10} = 41_8 = 100001_2$, representing the same value as hexadecimal, decimal, octal, and binary numbers, respectively. The factors $b^0$, $b^1$, $b^2$, and so forth are the place values of the digits. A base-$b$ number with a fractional part is written by appending a decimal point and digits with place values $b^{-1}$, $b^{-2}$, $b^{-3}$, and so forth; for example, $$101.011_2 = 1\cdot2^2 + 0\cdot2^1 + 1\cdot2^0 + 0\cdot2^{-1} + 1\cdot2^{-2} + 1\cdot2^{-3} = 4 + 1 + \frac14 + \frac18 = 5.375_{10}.$$

In a mixed-radix number system, such as the factorial number system, the ratio between the places value of two digits depends on their distances from the decimal point. A number system can have a negative radix, for example the negabinary number system, which has the radix $-2$.

Digital computing has raised interest in various other number systems. In an $n$-digit $b$'s-complement base-$b$ representation, the integer $-x$ is represented by $b^n - x$, whereas in a $(b-1)$'s complement representation, $-x$ is represented by $(b^n - 1) - x$. Computers often use two's-complement (or sometimes one's-complement) binary numbers.

Very large or small numbers can be written in scientific notation, for example $1.234 \times 10^9$. Floating-point numbers in digital computers, typically using the IEEE 754 standard, serve a similar purpose.

More esoteric number systems of interest in computer science include:

  • Balanced base-$b$ number systems, which use both positive and negative digit values. The balanced ternary (base $3$) system with digit values $\{-1,0,1\}$ is an example of this kind of number system.
  • Redundant base-$b$ systems, which allow more than $n$ values of each digit. There may be many ways to represent a given number in such a number system.
  • Residue number systems, in which each digit position is assigned a fixed modulus and the digit in that position is the remainder when the number's value is divided by that modulus.

Other possible numbering systems include the Fibonacci base system and systems using a non-integer radix such as the $\phi$ number system.

949 questions
1
vote
1 answer

How to tell if a base for a number system is consistent (a number has only one representation)?

Let's say I have a number system with an array defining the bases at each position. For example, [1,1,1] would be a binary number system (each digit can be 0 or 1) in which any number from 0 to 3 can be represented. Similarly, I can have [3,2,1]…
Rohit Pandey
  • 6,803
1
vote
0 answers

How to Most Succinctly Distinguish Base-n Numbers From Actual Numbers?

When reading mathematical texts I encounter phrases such as "the decimal number 2," the "binary number 10," etc., so much that I begin to imagine there really is such a thing as a "base-n number," whereas the reality (at least as far as I understand…
1
vote
2 answers

How to find the nth binary number?

I was wondering if there is mathematical formula or a way to get the nth binary number where n is given. Obviously, this is a very easy problem for a programmer and I can construct a program (using loops) to find it but am interested in a…
Seraph
  • 51
1
vote
2 answers

Base $7$ is backwards base $16$

Find the sum of all positive integers such that their expression in base $7$ digits is the reverse of their expression in base $16$ digits. Express your answer in base $10$. I tried expressing the digits as $d_1$ $d_2$... and making separate…
Noah D.
  • 123
1
vote
0 answers

Thinking in binary

I have been thinking about how to think in binary notation. I know that decimal notation is just one way to represent numbers. Yet the decimal notation is so ingrained into my concept of numbers, that it is hard to see, that it is only…
Jeník
  • 21
1
vote
1 answer

Proving set equality Z = {2a-3b, a,b $\in$ N}

I'm trying to prove that the above sets are equal. The integers can be mapped using the natural numbers and 2a-3b. My thought process is to use induction to prove that you can get positive numbers, all negative numbers, and then 0, but I'm having…
1
vote
1 answer

bases and binary

I can not figure this out. I started off by making a table and putting the base(2) on one side, the number in the middle and the remainder in the third row and for 2010 I got 11111011010 but I cant find the next two numbers please help and please…
1
vote
3 answers

Find the base system, $x$, such that $\frac{1}{5}$ and $\overline{.17}$ are numerals for the same number.

So far I know that $\frac{1}{5} = 0.2$ in base 10. However, I'm not really sure how to convert it into another base. Any suggestions would be greatly appreciated.
1
vote
2 answers

Octal System Conversion

So I am trying to change base ten 1,398 to an octal equivalent. I had assumed that I would find it by taking 1,398 and changing it like base-four. So 1,398 is $1*8^3 + 3*8^2 +9*8^1 + 8*8^0*$ or $512+192+72+8=784$ but I guess the answer is 2566.…
K Math
  • 1,245
  • 1
  • 11
  • 21
1
vote
2 answers

Number system conversions

I am an Electrical Engineering student but my question is related to number systems, more specificaly to conversions between octal, hexadecimal and binary systems. I know the rules of conversions but I don't get one thing: why is it possible to…
1
vote
1 answer

What is the hexadecimal representation?

A signed number in $2's$ compliment notation with $16-$bit register $P=DFA0$ What is the value of $P*4$? I have tried $P*4=0111111010000000$ but sign bit changed from $1$ to $0$. What is wrong with my solution?
1
vote
2 answers

Converting Decimal to Hexadecimal and viceversa

FIRSTLY, I hope this is the right forum to ask this question, otherwise please, tell me where should I re-post it or move it(if possible). So I have a situation in which I need to convert the "decimal" 74 to hexadecimal 4A. I currently know how to…
Kirasiris
  • 113
1
vote
0 answers

$2$'s, $10$'s and $16$'s complement

I want to find the $2$'s, $10$'s and $16$'s complement of numbers: $-63, -83$ and $-127$. I know how to find $2$'s complement. What confuses me is $10$'s and $16$'s complement. Can anyone please verify my computation? So, I first compute the $2$'s…
1
vote
1 answer

Multiplication of two number in 2's complement

Suppose that we have two n bit, binary numbers in 2'th complement. If we multiply them the result needs less than 2n bits except in one state result needs 2n bit. What is that state?
Navid
  • 35
1
vote
2 answers

Why the hexadecimal numbers can be converted directly into binary numbers so cleanly?

Suppose we have F9 hex. If we want to convert it into binary, we just replace the hexadecimal numbers with their corresponding binary numbers. Like 9 has1001 in binary and F has 1111 in binary. By combining it becomes 1111 1001. But why does it give…