A quaternary
numeral system
A numeral system (or system of numeration) is a writing system for expressing numbers; that is, a mathematical notation for representing numbers of a given set, using digits or other symbols in a consistent manner.
The same sequence of symbo ...
is
base-. It uses the
digits 0, 1, 2 and 3 to represent any
real number
In mathematics, a real number is a number that can be used to measure a ''continuous'' one-dimensional quantity such as a distance, duration or temperature. Here, ''continuous'' means that values can have arbitrarily small variations. Every ...
. Conversion from
binary
Binary may refer to:
Science and technology Mathematics
* Binary number, a representation of numbers using only two digits (0 and 1)
* Binary function, a function that takes two arguments
* Binary operation, a mathematical operation that ta ...
is straightforward.
Four is the largest number within the
subitizing range and one of two numbers that is both a square and a
highly composite number
__FORCETOC__
A highly composite number is a positive integer with more divisors than any smaller positive integer has. The related concept of largely composite number refers to a positive integer which has at least as many divisors as any smaller ...
(the other being 36), making quaternary a convenient choice for a base at this scale. Despite being twice as large, its
radix economy
The radix economy of a number in a particular base (or radix) is the number of digits needed to express it in that base, multiplied by the base (the number of possible values each digit could have). This is one of various proposals that have been ...
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
A senary () numeral system (also known as base-6, heximal, or seximal) has six as its base. It has been adopted independently by a small number of cultures. Like decimal, it is a semiprime, though it is unique as the product of the only two co ...
).
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 number
In mathematics, a rational number is a number that can be expressed as the quotient or fraction of two integers, a numerator and a non-zero denominator . For example, is a rational number, as is every integer (e.g. ). The set of all rat ...
s and
irrational number
In mathematics, the irrational numbers (from in- prefix assimilated to ir- (negative prefix, privative) + rational) are all the real numbers that are not rational numbers. That is, irrational numbers cannot be expressed as the ratio of two inte ...
s. See
decimal and
binary
Binary may refer to:
Science and technology Mathematics
* Binary number, a representation of numbers using only two digits (0 and 1)
* Binary function, a function that takes two arguments
* Binary operation, a mathematical operation that ta ...
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 base-8 number system, and uses the digits 0 to 7. This is to say that 10octal represents eight and 100octal represents sixty-four. However, English, like most languages, uses a base-10 number ...
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
bit
The bit is the most basic unit of information in computing and digital communications. The name is a portmanteau of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represente ...
s. 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
Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, e ...
and
computer programming
Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as anal ...
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 ca ...
(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
Ventureño is a member of the extinct Chumashan languages, a group of Native American languages previously spoken by the Chumash people along the coastal areas of Southern California from as far north as San Luis Obispo to as far south as Malib ...
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 curve
The Hilbert curve (also known as the Hilbert space-filling curve) is a continuous fractal space-filling curve first described by the German mathematician David Hilbert in 1891, as a variant of the space-filling Peano curves discovered by Giuseppe ...
s. 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 biomolecule ...
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 0, 1, 2, and 3. With this encoding, the
complementary
A complement is something that completes something else.
Complement may refer specifically to:
The arts
* Complement (music), an interval that, when added to another, spans an octave
** Aggregate complementation, the separation of pitch-class ...
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.
For example, the nucleotide sequence GATTACA can be represented by the quaternary number 2033010 (=
decimal 9156 or
binary
Binary may refer to:
Science and technology Mathematics
* Binary number, a representation of numbers using only two digits (0 and 1)
* Binary function, a function that takes two arguments
* Binary operation, a mathematical operation that ta ...
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 c ...
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