نظام عد رباعي

نظام العد الرباعي (بالإنجليزية: Quaternary numeral system) هو نظام عد ذو رقم أساس 4، ويسمى هذا النظام عد رباعي وهي تستخدم غالباً تحت عنوان "أنظمة خاصة" أي أنها ليست شائعة في استخدامها كثيراً في تحويلها إلى نظام عد آخر.[1]

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Relation to other positional number systems

Numbers zero to sixty-four in standard quaternary
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Quaternary 0 1 2 3 10 11 12 13 20 21 22 23 30 31 32 33
Octal 0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17
Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F
Binary 0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111
Decimal 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Quaternary 100 101 102 103 110 111 112 113 120 121 122 123 130 131 132 133
Octal 20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37
Hexadecimal 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
Binary 10000 10001 10010 10011 10100 10101 10110 10111 11000 11001 11010 11011 11100 11101 11110 11111
Decimal 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
Quaternary 200 201 202 203 210 211 212 213 220 221 222 223 230 231 232 233
Octal 40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57
Hexadecimal 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
Binary 100000 100001 100010 100011 100100 100101 100110 100111 101000 101001 101010 101011 101100 101101 101110 101111
Decimal 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
Quaternary 300 301 302 303 310 311 312 313 320 321 322 323 330 331 332 333 1000
Octal 60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77 100
Hexadecimal 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 40
Binary 110000 110001 110010 110011 110100 110101 110110 110111 111000 111001 111010 111011 111100 111101 111110 111111 1000000


Relation to binary and hexadecimal

addition table
+ 1 2 3
1 2 3 10
2 3 10 11
3 10 11 12

As with the octal and hexadecimal numeral systems, quaternary has a special relation to the binary numeral system. Each radix 4, 8 and 16 is a power of 2, so the conversion to and from binary is implemented by matching each digit with 2, 3 or 4 binary digits, or bits. For example, in base 4,

2302104 = 10 11 00 10 01 002.

Since 16 is a power of 4, conversion between these bases can be implemented by matching each hexadecimal digit with 2 quaternary digits. In the above example,

23 02 104 = B2416
multiplication table
× 1 2 3
1 1 2 3
2 2 10 12
3 3 12 21

Although octal and hexadecimal are widely used in computing and computer programming in the discussion and analysis of binary arithmetic and logic, quaternary does not enjoy the same status.

Although quaternary has limited practical use, it can be helpful if it is ever necessary to perform hexadecimal arithmetic without a calculator. Each hexadecimal digit can be turned into a pair of quaternary digits, and then arithmetic can be performed relatively easily before converting the end result back to hexadecimal. Quaternary is convenient for this purpose, since numbers have only half the digit length compared to binary, while still having very simple multiplication and addition tables with only three unique non-trivial elements.

By analogy with byte and nybble, a quaternary digit is sometimes called a crumb.

Fractions

Due to having only factors of two, many quaternary fractions have repeating digits, although these tend to be fairly simple:

Decimal base
Prime factors of the base: 2, 5
Prime factors of one below the base: 3
Prime factors of one above the base: 11
Other Prime factors: 7 13
Quaternary base
Prime factors of the base: 2
Prime factors of one below the base: 3
Prime factors of one above the base: 11
Other Prime factors: 13 23 31
Fraction Prime factors
of the denominator
Positional representation Positional representation Prime factors
of the denominator
Fraction
1/2 2 0.5 0.2 2 1/2
1/3 3 0.3333... = 0.3 0.1111... = 0.1 3 1/3
1/4 2 0.25 0.1 2 1/10
1/5 5 0.2 0.03 11 1/11
1/6 2, 3 0.16 0.02 2, 3 1/12
1/7 7 0.142857 0.021 13 1/13
1/8 2 0.125 0.02 2 1/20
1/9 3 0.1 0.013 3 1/21
1/10 2, 5 0.1 0.012 2, 11 1/22
1/11 11 0.09 0.01131 23 1/23
1/12 2, 3 0.083 0.01 2, 3 1/30
1/13 13 0.076923 0.010323 31 1/31
1/14 2, 7 0.0714285 0.0102 2, 13 1/32
1/15 3, 5 0.06 0.01 3, 11 1/33
1/16 2 0.0625 0.01 2 1/100

انظر أيضاً

الهامش

  1. ^ "Archived copy" (PDF). Archived from the original (PDF) on December 14, 2010. Retrieved November 27, 2010. {{cite web}}: Unknown parameter |deadurl= ignored (|url-status= suggested) (help)CS1 maint: archived copy as title (link)

External links