Quaternary numeral system

Quaternary is the base-4 numeral system. It uses the digits 0, 1, 2 and 3 to represent any real number.

Four is the largest number within the subitizing range and one of two numbers that is both a square and a highly composite number (the other being 36), making quaternary a convenient choice for a base at this scale. Despite being twice as large, its radix economy is equal to that of binary. However, it fares no better in the localization of prime numbers (the smallest better base being the primorial base six, senary).

Quaternary shares with all fixed-radix numeral systems many properties, such as the ability to represent any real number with a canonical representation (almost unique) and the characteristics of the representations of rational numbers and irrational numbers. See decimal and binary for a discussion of these properties.

Relation to other positional number systems

Numbers zero to sixty-four in standard quaternary
Decimal 0123456789101112131415
Quaternary 0123101112132021222330313233
Octal 012345671011121314151617
Hexadecimal 0123456789ABCDEF
Binary 01101110010111011110001001101010111100110111101111
Decimal 16171819202122232425262728293031
Quaternary 100101102103110111112113120121122123130131132133
Octal 20212223242526273031323334353637
Hexadecimal 101112131415161718191A1B1C1D1E1F
Binary 10000100011001010011101001010110110101111100011001110101101111100111011111011111
Decimal 32333435363738394041424344454647
Quaternary 200201202203210211212213220221222223230231232233
Octal 40414243444546475051525354555657
Hexadecimal 202122232425262728292A2B2C2D2E2F
Binary 100000100001100010100011100100100101100110100111101000101001101010101011101100101101101110101111
Decimal 4849505152535455565758596061626364
Quaternary 3003013023033103113123133203213223233303313323331000
Octal 60616263646566677071727374757677100
Hexadecimal 303132333435363738393A3B3C3D3E3F40
Binary 1100001100011100101100111101001101011101101101111110001110011110101110111111001111011111101111111000000

Relation to binary and hexadecimal

addition
table
+123
12310
231011
3101112

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

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.

multiplication
table
×123
1123
221012
331221

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 17 19 23 29 31
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 101 103 113 131 133
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/17 17 0.0588235294117647 0.0033 101 1/101
1/18 2, 3 0.05 0.0032 2, 3 1/102
1/19 19 0.052631578947368421 0.003113211 103 1/103
1/20 2, 5 0.05 0.003 2, 11 1/110
1/21 3, 7 0.047619 0.003 3, 13 1/111
1/22 2, 11 0.045 0.002322 2, 23 1/112
1/23 23 0.0434782608695652173913 0.00230201121 113 1/113
1/24 2, 3 0.0416 0.002 2, 3 1/120
1/25 5 0.04 0.0022033113 11 1/121
1/26 2, 13 0.0384615 0.0021312 2, 31 1/122
1/27 3 0.037 0.002113231 3 1/123
1/28 2, 7 0.03571428 0.0021 2, 13 1/130
1/29 29 0.0344827586206896551724137931 0.00203103313023 131 1/131
1/30 2, 3, 5 0.03 0.002 2, 3, 11 1/132
1/31 31 0.032258064516129 0.00201 133 1/133
1/32 2 0.03125 0.002 2 1/200
1/33 3, 11 0.03 0.00133 3, 23 1/201
1/34 2, 17 0.02941176470588235 0.00132 2, 101 1/202
1/35 5, 7 0.0285714 0.001311 11, 13 1/203
1/36 2, 3 0.027 0.0013 2, 3 1/210

Occurrence in human languages

Many or all of the Chumashan languages originally used a base 4 counting system, in which the names for numbers were structured according to multiples of 4 and 16 (not 10). There is a surviving list of Ventureño language number words up to 32 written down by a Spanish priest ca. 1819.[1]

The Kharosthi numerals have a partial base 4 counting system from 1 to decimal 10.

Hilbert curves

Quaternary numbers are used in the representation of 2D Hilbert curves. Here a real number between 0 and 1 is converted into the quaternary system. Every single digit now indicates in which of the respective 4 sub-quadrants the number will be projected.

Genetics

Parallels can be drawn between quaternary numerals and the way genetic code is represented by DNA. The four DNA nucleotides in alphabetical order, abbreviated A, C, G and T, can be taken to represent the quaternary digits in numerical order 0, 1, 2, and 3. With this encoding, the complementary digit pairs 0↔3, and 1↔2 (binary 00↔11 and 01↔10) match the complementation of the base pairs: A↔T and C↔G and can be stored as data in DNA sequence.[2]

For example, the nucleotide sequence GATTACA can be represented by the quaternary number 2033010 (= decimal 9156 or binary 10 00 11 11 00 01 00).

Data transmission

Quaternary line codes have been used for transmission, from the invention of the telegraph to the 2B1Q code used in modern ISDN circuits.

Computing

Some computers have used quaternary floating point arithmetic including the Illinois ILLIAC II (1962)[3] and the Digital Field System DFS IV and DFS V high-resolution site survey systems.[4]

gollark: - post all of them on reddit and see if someone says one is a repost of another
gollark: Some very rough ideas for how to detect similar images:- remove blank space at top/bottom/sides and do the rest of these- run OCR over the text and check for matches- split image up into chunks, reduce the color space a lot, count how many times each color appears, check for similar chunks in other images- run edge detection on them, get locations of edges, fuzzy matching of those- ML-based object detection?- some sort of locality-sensitive hashing for image data
gollark: Probably, but I don't know what software or have any idea how it works.
gollark: Or look at how the repost detection bots do it.
gollark: Really? I'll have to look into this then.

See also

References

  1. Beeler, Madison S. (1986). "Chumashan Numerals". In Closs, Michael P. (ed.). Native American Mathematics. ISBN 0-292-75531-7.
  2. "Bacterial based storage and encryption device" (PDF). iGEM 2010: The Chinese University of Hong Kong. 2010. Archived from the original (PDF) on 2010-12-14. Retrieved 2010-11-27.CS1 maint: location (link)
  3. Beebe, Nelson H. F. (2017-08-22). "Chapter H. Historical floating-point architectures". The Mathematical-Function Computation Handbook - Programming Using the MathCW Portable Software Library (1 ed.). Salt Lake City, UT, USA: Springer International Publishing AG. p. 948. doi:10.1007/978-3-319-64110-2. ISBN 978-3-319-64109-6. LCCN 2017947446.
  4. Parkinson, Roger (2000-12-07). "Chapter 2 - High resolution digital site survey systems - Chapter 2.1 - Digital field recording systems". High Resolution Site Surveys (1 ed.). CRC Press. p. 24. ISBN 978-0-20318604-6. ISBN 0-20318604-4. Retrieved 2019-08-18. [...] Systems such as the [Digital Field System] DFS IV and DFS V were quaternary floating-point systems and used gain steps of 12 dB. [...] (256 pages)
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.