PAIBOTLearn
Sign inSign up

Number bases

Number theory basics

Japanese school year: Math A

What you learn

You will learn how to represent numbers using different bases, such as binary and hexadecimal, and how to convert between them. This is fundamental in computer science and digital data representation. Prior familiarity with place value in the base-ten system and integer division is recommended.

Go to practice

Key points

This formula converts a base-nn integer into base 10. Multiply each digit aa by its place value (a power of nn) and sum them together.

(akak−1…a0)(n)=aknk+ak−1nk−1+⋯+a0(a_k a_{k-1} \dots a_0)_{(n)} = a_k n^k + a_{k-1} n^{k-1} + \dots + a_0

This rule defines the range of digits in base nn. Each digit aia_i must be an integer from 0 up to n−1n - 1 (for example, base 2 uses only 0 and 1).

0≤ai<n0 \le a_i < n

This formula converts a base-nn fraction into base 10. Divide each fractional digit aa by successive powers of nn (such as nn and n2n^2) and add them up.

(0.a1a2…am)(n)=a1n+a2n2+⋯+amnm(0.a_1 a_2 \dots a_m)_{(n)} = \frac{a_1}{n} + \frac{a_2}{n^2} + \dots + \frac{a_m}{n^m}

This is the procedure to convert a base-10 integer into base nn. Repeatedly divide the number by nn until the quotient is 0, then write down the remainders in reverse order.

Choose a set to practice.