A quaternary
numeral system is
base-. It uses the
digits 0, 1, 2 and 3 to represent any
real number. Conversion from
binary is straightforward.
Four is the largest number within the
subitizing
Subitizing is the rapid, accurate, and confident judgments of numbers performed for small numbers of items. The term was coined in 1949 by E. L. Kaufman et al., and is derived from the Latin adjective '' subitus'' (meaning "sudden") and capture ...
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
Relation to binary and hexadecimal
As with the
octal
The octal numeral system, or oct for short, is the radix, base-8 number system, and uses the Numerical digit, digits 0 to 7. This is to say that 10octal represents eight and 100octal represents sixty-four. However, English, like most languages, ...
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,
:230210
4 = 10 11 00 10 01 00
2.
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 10
4 = B24
16
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:
Occurrence in human languages
Many or all of the
Chumashan languages
Chumashan was a family of languages that were spoken on the southern California coast by Native American Chumash people, from the Coastal plains and valleys of San Luis Obispo to Malibu, neighboring inland and Transverse Ranges valleys and c ...
(spoken by the Native American
Chumash peoples) 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.
The
Kharosthi numerals
The Kharoṣṭhī script, also spelled Kharoshthi (Kharosthi: ), was an ancient Indo-Iranians, Indo-Iranian script used by various Aryan peoples in north-western regions of the Indian subcontinent, more precisely around present-day northern ...
(from the languages of the tribes of Pakistan and Afghanistan) 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
The genetic code is the set of rules used by living cells to translate information encoded within genetic material ( DNA or RNA sequences of nucleotide triplets, or codons) into proteins. Translation is accomplished by the ribosome, which links ...
is represented by
DNA. The four DNA
nucleotide
Nucleotides are organic molecules consisting of a nucleoside and a phosphate. They serve as monomeric units of the nucleic acid polymers – deoxyribonucleic acid (DNA) and ribonucleic acid (RNA), both of which are essential biomolecu ...
s in
alphabetical order
Alphabetical order is a system whereby character strings are placed in order based on the position of the characters in the conventional ordering of an alphabet. It is one of the methods of collation. In mathematics, a lexicographical order is t ...
, abbreviated
A,
C,
G and
T, can be taken to represent the quaternary digits in
numerical order
In mathematics, a sequence is an enumerated collection of objects in which repetitions are allowed and order matters. Like a set, it contains members (also called ''elements'', or ''terms''). The number of elements (possibly infinite) is called ...
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 pair
A base pair (bp) is a fundamental unit of double-stranded nucleic acids consisting of two nucleobases bound to each other by hydrogen bonds. They form the building blocks of the DNA double helix and contribute to the folded structure of both D ...
s: A↔T and C↔G and can be stored as data in DNA sequence.
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). The
human genome
The human genome is a complete set of nucleic acid sequences for humans, encoded as DNA within the 23 chromosome pairs in cell nuclei and in a small DNA molecule found within individual mitochondria. These are usually treated separately as the ...
is 3.2 billion base pairs in length.
Data transmission
Quaternary
line code
In telecommunication, a line code is a pattern of voltage, current, or photons used to represent digital data transmitted down a communication channel or written to a storage medium. This repertoire of signals is usually called a constrained ...
s have been used for transmission, from the
invention of the telegraph to the
2B1Q code used in modern
ISDN
Integrated Services Digital Network (ISDN) is a set of communication standards for simultaneous digital transmission of voice, video, data, and other network services over the digitalised circuits of the public switched telephone network. Work ...
circuits.
The GDDR6X standard, developed by
Nvidia
Nvidia CorporationOfficially written as NVIDIA and stylized in its logo as VIDIA with the lowercase "n" the same height as the uppercase "VIDIA"; formerly stylized as VIDIA with a large italicized lowercase "n" on products from the mid 1990s to ...
and
Micron
The micrometre ( international spelling as used by the International Bureau of Weights and Measures; SI symbol: μm) or micrometer (American spelling), also commonly known as a micron, is a unit of length in the International System of Un ...
uses quaternary bits to transmit data
Computing
Some computers have used
quaternary floating point arithmetic including the
Illinois ILLIAC II (1962)
and the Digital Field System DFS IV and DFS V high-resolution site survey systems.
See also
*
Conversion between bases
*
Moser–de Bruijn sequence
In number theory, the Moser–de Bruijn sequence is an integer sequence named after Leo Moser and Nicolaas Govert de Bruijn, consisting of the sums of distinct powers of 4, or equivalently the numbers whose binary representations are nonzero o ...
, the numbers that have only 0 or 1 as their base-4 digits
References
External links
{{commons category
Quaternary Base Conversion includes fractional part, from
Math Is Fun
Base42Proposes unique symbols for Quaternary and Hexadecimal digits
Power-of-two numeral systems