Overview
The number 21, spelled out as twenty-one, is an odd positive integer. In mathematics, every integer has a unique set of properties that define its role in arithmetic, algebra, and number theory. On this page we explore everything there is to know about the number 21 — from its divisibility and prime factorization to its trigonometric values, binary representation, and cryptographic hashes.
Parity and Sign
The number 21 is odd, which means it leaves a remainder of 1 when divided by 2. Odd numbers have distinct properties in modular arithmetic and appear frequently in number theory, combinatorics, and cryptography.As a positive number, 21 lies to the right of zero on the number line. Its absolute value is 21.
Primality and Factorization
21 is a composite number, meaning it has divisors other than 1 and itself. Specifically, 21 has 4 divisors: 1, 3, 7, 21. The sum of its proper divisors (all divisors except 21 itself) is 11, which makes 21 a deficient number, since 11 < 21. Most integers are deficient — the sum of their proper divisors falls short of the number itself.
The prime factorization of 21 is 3 × 7. Prime factorization is essential for computing the greatest common divisor (GCD) and least common multiple (LCM), simplifying fractions, and solving problems in modular arithmetic. The nearest primes to 21 are 19 and 23.
Special Classifications
Beyond basic primality, number theorists have identified many special categories that a number can belong to. 21 is a Fibonacci number — it belongs to the famous sequence where each term is the sum of the two preceding ones (0, 1, 1, 2, 3, 5, 8, 13, 21, ...). Fibonacci numbers appear throughout nature in sunflower spirals, pinecone patterns, and the branching of trees, and their ratio converges to the golden ratio φ ≈ 1.618. 21 is a Harshad number (from Sanskrit “joy-giver”) — it is divisible by the sum of its digits (3). Harshad numbers connect divisibility theory with digit-based properties of integers.
Digit Properties
The digits of 21 sum to 3, and its digital root (the single-digit value obtained by repeatedly summing digits) is 3. The number 21 has 2 digits in its decimal representation. Digit sums are fundamental to divisibility tests: a number is divisible by 3 if and only if its digit sum is divisible by 3, and the same holds for divisibility by 9. The digital root, also known as the repeated digital sum, has applications in casting out nines — a centuries-old technique for verifying arithmetic calculations.
Number Base Conversions
In the binary (base-2) number system, 21 is represented as 10101.
Binary is the language of digital computers — every file, image, video, and program is ultimately
stored as a sequence of binary digits (bits). In octal (base-8), 21 is
25, a system historically used in computing because each octal digit corresponds to exactly
three binary digits. In hexadecimal (base-16), 21 is 15 —
hex is ubiquitous in programming for representing memory addresses, color codes (#FF5733), and byte values.
The Base64 encoding of the string “21” is MjE=.
Base64 is widely used in web development for encoding binary data in URLs, email attachments (MIME),
JSON Web Tokens (JWT), and data URIs in HTML and CSS.
Mathematical Functions
The square of 21 is 441 (i.e. 21²), and its square root is approximately 4.582576. The cube of 21 is 9261, and its cube root is approximately 2.758924. The reciprocal (1/21) is 0.04761904762.
The natural logarithm (ln) of 21 is 3.044522, the base-10 logarithm is 1.322219, and the base-2 logarithm is 4.392317. Logarithms are essential in measuring earthquake magnitudes (Richter scale), sound levels (decibels), acidity (pH), and information content (bits).
Trigonometry
Treating 21 as an angle in radians, the principal trigonometric functions yield: sin(21) = 0.8366556385, cos(21) = -0.5477292602, and tan(21) = -1.527498528. The hyperbolic functions give: sinh(21) = 659407867.2, cosh(21) = 659407867.2, and tanh(21) = 1. Trigonometric functions are indispensable in physics (wave motion, oscillations, alternating current), engineering (signal processing, structural analysis), computer graphics (rotations, projections), and navigation (GPS, celestial mechanics).
Cryptographic Hashes
When the string “21” is passed through standard cryptographic hash functions, the results are:
MD5: 3c59dc048e8850243be8079a5c74d079,
SHA-1: 472b07b9fcf2c2451e8781e944bf5f77cd8457c8,
SHA-256: 6f4b6612125fb3a0daecd2799dfd6c9c299424fd920f9b308110a2c1fbd8f443, and
SHA-512: 198dabf4bac21cf35cddb48db0f8b67c56b2bdf63767242aea7342fe68c0b9df8d37f3e47a134648e19f1640e158f2e527e636db122a9143307cf309efcb85d9.
Cryptographic hashes are one-way functions that produce a fixed-size output from any input. They are used for
data integrity verification (detecting file corruption or tampering),
password storage (storing hashes instead of plaintext passwords),
digital signatures, blockchain technology (Bitcoin uses SHA-256),
and content addressing (Git uses SHA-1 to identify objects).
Collatz Conjecture
The Collatz conjecture (also known as the 3n + 1 problem) is one of the most famous unsolved problems in mathematics. Starting from 21 and repeatedly applying the rule — divide by 2 if even, multiply by 3 and add 1 if odd — the sequence reaches 1 in 7 steps. Despite its simplicity, no one has been able to prove that this process always terminates for every starting number, and the conjecture remains open since it was first proposed by Lothar Collatz in 1937.
Roman Numerals
In the Roman numeral system, 21 is written as XXI. Roman numerals originated in ancient Rome and use combinations of letters (I, V, X, L, C, D, M) with subtractive notation for certain values. They remain in use today on clock faces, in book chapters, film sequels, and formal outlines.
Programming
In software development, the number 21 can be represented across dozens of programming languages.
For example, in C# you would write int number = 21;,
in Python simply number = 21,
in JavaScript as const number = 21;,
and in Rust as let number: i32 = 21;.
Math.Number provides initialization code for 27 programming languages, making it a handy
quick-reference for developers working across different technology stacks.