Quaternary (Base 4) Converter
Convert between decimal and quaternary (base 4) number systems
Understanding the Quaternary (Base 4) Number System
The quaternary number system, also known as base 4, is a positional numeral system that uses four digits: 0, 1, 2, and 3. Each position in a quaternary number represents a power of 4, making it a compact way to represent numbers. Quaternary systems have applications in computer science, particularly in areas involving DNA encoding, information theory, and certain types of data compression.
How Quaternary Numbers Work
Positional Values
In quaternary, each digit position represents a power of 4:
Position:
3
2
1
0
Power:
4³
4²
4¹
4⁰
Value:
64
16
4
1
Decimal to Quaternary Example
Converting 27 to quaternary:
27 ÷ 4 = 6 remainder 3
6 ÷ 4 = 1 remainder 2
1 ÷ 4 = 0 remainder 1
Reading remainders bottom-up: 123₄
Verification: 1×4² + 2×4¹ + 3×4⁰ = 16 + 8 + 3 = 27
Quaternary to Decimal Example
Converting 123₄ to decimal:
1×4² = 1×16 = 16
2×4¹ = 2×4 = 8
3×4⁰ = 3×1 = 3
Sum: 16 + 8 + 3 = 27
Applications of Quaternary System
DNA Encoding
- • Natural representation for DNA bases
- • A, T, G, C mapping to 0-3
- • Bioinformatics applications
- • Genetic sequence analysis
Information Theory
- • Data compression
- • Error correction codes
- • Signal processing
- • Communication protocols
Computer Science
- • Multi-valued logic systems
- • State machine encoding
- • Memory-efficient storage
- • Algorithm optimization