📚 Quantitative Aptitude – Number System
Target Audience: IIT‑JEE / other competitive exams
Program: JEST (JavaScript testing framework) – the notes are written in a style that can be used to create automated tests for the concepts discussed.
Table of Contents
- Basics of Positional Notation
- Decimal ↔︎ Binary ↔︎ Octal ↔︎ Hexadecimal
- Conversions Between Arbitrary Bases
- Arithmetic in Base‑b
- Divisibility & Trailing Zeros
- Negative Numbers & Two’s Complement
- Fractions & Repeating Patterns
- Bitwise Operations (JEST‑friendly)
- Important Formulae & Tricks
- Hard Practice Question + Solution
1. Basics of Positional Notation <a name="1"></a>
| Symbol | Meaning | Example (Base 10) |
|---|---|---|
b |
Base (radix) | 10 |
dₙdₙ₋₁ … d₁d₀ |
Representation of an integer | 1234 |
b⁰, b¹, …, bⁿ |
Place values | 1, 10, 100, 1000 |
Decimal value of a base‑b number
[
N = \sum_{k=0}^{n} d_k , b^k
]
where d_k ∈ {0, 1, …, b‑1}.
Length of representation
[
\operatorname{len}_b(N) = \left\lfloor\log_b N\right\rfloor + 1
]
Trick: In any base
b, the digitbis not allowed; it becomes10(carry‑over).
2. Decimal ↔︎ Binary ↔︎ Octal ↔︎ Hexadecimal <a name="2"></a>
| Base | Grouping in Decimal | Typical use |
|---|---|---|
| 2 | 1 bit | Machine level |
| 8 | 3 bits | Unix file perms |
| 10 | 1 digit | Everyday |
| 16 | 4 bits | Memory addresses |
2.1 Decimal → Binary (Repeated Division)
- Divide by 2.
- Record remainder (0 or 1).
- Repeat with quotient until 0.
- Remainders read bottom‑to‑top.
Example: 13 → 1101₂
2.2 Binary → Decimal (Place Value)
[ 13 = 1\cdot 2^3 + 1\cdot 2^2 + 0\cdot 2^1 + 1\cdot 2^0 = 8+4+0+1 ]
2.3 Binary ↔︎ Octal / Hex
-
Binary → Octal: Group bits in 3 from right.
If leftmost group has <3 bits, pad with 0s.
Example:110110→110 110→6 6→66₈. -
Binary → Hex: Group bits in 4.
Example:11110010→1111 0010→F 2→F2₁₆. -
Octal / Hex → Binary: Reverse process.
3. Conversions Between Arbitrary Bases <a name="3"></a>
3.1 Decimal → Base‑b
Repeat division by b (as in 2.1).
Time complexity: O(log_b N).
3.2 Base‑b → Decimal
Use place value sum.
Example: `