Professional Documents
Culture Documents
Computational Mathematics For Information System
Computational Mathematics For Information System
2023
The Foundation of Logic
Representations of Integers
In everyday life we use decimal notation to express integers.
2
For example, 965 is used to denote 9 · 10 + 6 · 10 + 5 (it is used base 10, or decimal
expansions)
We can use any integer greater than 1 as the base when expressing integers.
This is stated in Theorem 1.
Theorem 1.
Example:
2
(245)8 represents 2 · 8 + 4 · 8 + 5 = 165
Binary expansions
Choosing 2 as the base gives binary expansions of integers.
In binary notation each digit is either a 0 or a 1.
Example:
What is the decimal expansion of the integer that has (1 0101 1111)2 as its binary expansion?
Solution:
8 7 6 5 4 3 2 1 0
(1 0101 1111)2 = 1 · 2 + 0 · 2 + 1 · 2 + 0 · 2 + 1 · 2 + 1 · 2 + 1 · 2 + 1 · 2 + 1 · 2 = 351
Note:
2 1 0
(351)10 = 351 because 351 = 3 · 10 + 5 · 10 + 1 · 10
Example:
What is the decimal expansion of the number with hexadecimal expansion (2𝐴𝐸0𝐵)16?
Solution:
4 3 2 1 0
(2𝐴𝐸0𝐵)16 = 2 · 16 + 10 · 16 + 14 · 16 + 0 · 16 + 11 · 16 = 175627
Bytes (bit strings of length eight) can be represented by two hexadecimal digits.
Base Conversion.
Example:
Find the binary expansion of (241)10.
Solution:
241 = 2 · 120 + 1
120 = 2 · 60 + 0
60 = 2 · 30 + 0
30 = 2 · 15 + 0 Thus, (241)10 = (1111 0001)2
15 = 2 · 7 + 1
7 = 2·3+1
3=2·1+1
1 = 2 · 0 + 1 (stop)
Example:
Find the hexadecimal expansion of (691)10.
Solution:
691 = 16 · 43 + 3 (11 = B)
43 = 16 · 2 + 11
2 = 16 · 0 + 2 Thus, (691)10 = (2𝐵3)16
(stop)