Overview

We normally write numbers in base 1010, using ten digits 00 through 99. But there is nothing special about ten. Any positive integer b≥2b \ge 2 can serve as a base, and understanding how bases work opens up a family of techniques that appear regularly on the AMC, AIME, etc.

The main idea is that a number's representation in base bb directly encodes its remainders and quotients when divided by powers of bb. This connects base representations to modular arithmetic.

What Is a Base?

In base bb, we write a number using digits 0,1,2,…,b−10, 1, 2, \ldots, b-1 and place values that are powers of bb.

The base bb representation

anan−1⋯a1a0‾ b\overline{a_n a_{n-1} \cdots a_1 a_0}_{\,b}

stands for the value

an(bn)+an−1(bn−1)+⋯+a1(b)+a0.a_n(b^n) + a_{n-1}(b^{n-1}) + \cdots + a_1(b) + a_0.

Each digit aia_i satisfies 0≤ai≤b−10 \le a_i \le b-1.

For example, in base 1010:

3472=3(103)+4(102)+7(10)+2.3472 = 3(10^3) + 4(10^2) + 7(10) + 2.

In base 22 (binary):

11012=1(23)+1(22)+0(2)+1=8+4+0+1=13.1101_2 = 1(2^3) + 1(2^2) + 0(2) + 1 = 8 + 4 + 0 + 1 = 13.

Common Bases

A few bases come up often in competition math:

  • Base 22 (binary): digits are 00 and 11. Useful in combinatorics and problems about subsets.
  • Base 33 (ternary): digits are 0,1,20, 1, 2. Appears in balanced ternary and weighing problems.
  • Base 88 (octal) and base 1616 (hexadecimal): occasionally appear in digit manipulation problems.

However, contest problems can use any base, including large or variable ones.

Converting Base bb to Base 1010

Expand using the definition:

20315=2(53)+0(52)+3(5)+1=250+0+15+1=266.2031_5 = 2(5^3) + 0(5^2) + 3(5) + 1 = 250 + 0 + 15 + 1 = 266.

Another example:

1A316=1(162)+10(16)+3=256+160+3=4191A3_{16} = 1(16^2) + 10(16) + 3 = 256 + 160 + 3 = 419

where AA represents the digit 1010 in hexadecimal.

Converting Base 1010 to Base bb

Repeatedly divide by bb and record the remainders. The remainders, read from bottom to top, give the base bb digits.

Convert 8383 to base 33:

83=27(3)+283 = 27(3) + 2
27=9(3)+027 = 9(3) + 0
9=3(3)+09 = 3(3) + 0
3=1(3)+03 = 1(3) + 0
1=0(3)+11 = 0(3) + 1

Reading the remainders from bottom to top: 83=10002383 = 10002_3.

We can verify: 1(34)+0+0+0+2=81+2=831(3^4) + 0 + 0 + 0 + 2 = 81 + 2 = 83.

The Last Digit Rule

This is one of the most useful facts about bases in competition math:

The last digit of NN in base bb is the remainder when NN is divided by bb.

In symbols,

N≡a0(modb)N \equiv a_0 \pmod{b}

where a0a_0 is the units digit of the base bb representation of NN.

This follows directly from the expansion, every term except a0a_0 is a multiple of bb.

Similarly, the last two digits of NN in base bb encode N(modb2)N \pmod{b^2}, and so on.

The Digit Sum and Casting Out

In base 1010, we know a number is divisible by 99 when its digit sum is divisible by 99. This generalises:

In base bb, a number is divisible by b−1b-1 if and only if the sum of its base-bb digits is divisible by b−1b-1.

This is because b≡1(modb−1)b \equiv 1 \pmod{b-1}, so every power bk≡1(modb−1)b^k \equiv 1 \pmod{b-1}, and therefore

an⋯a0‾ b≡an+⋯+a0(modb−1).\overline{a_n \cdots a_0}_{\,b} \equiv a_n + \cdots + a_0 \pmod{b-1}.

Counting Digits

A positive integer NN has exactly dd digits in base bb if and only if

bd−1≤N<bd.b^{d-1} \le N < b^d.

Equivalently,

d=⌊log⁡bN⌋+1.d = \lfloor \log_b N \rfloor + 1.

For example, 100100 in base 22 has ⌊log⁡2100⌋+1=6+1=7\lfloor \log_2 100 \rfloor + 1 = 6 + 1 = 7 digits, since 26=64≤100<128=272^6 = 64 \le 100 < 128 = 2^7.

Worked Examples

Example 1

Convert 345345 to base 77.

345=49(7)+2345 = 49(7) + 2
49=7(7)+049 = 7(7) + 0
7=1(7)+07 = 1(7) + 0
1=0(7)+11 = 0(7) + 1

Reading remainders bottom to top: 345=10027345 = 1002_7.

Check: 1(73)+0+0+2=343+2=3451(7^3) + 0 + 0 + 2 = 343 + 2 = 345.

Example 2 (2013 AMC 10A Problem 19)

In base 1010, the number 20132013 ends in the digit 33. In base 99, the same number is written as (2676)9(2676)_9 and ends in the digit 66. For how many positive integers bb does the base-bb representation of 20132013 end in the digit 33?

By the last digit rule, the base-bb representation of 20132013 ends in 33 if and only if

2013≡3(modb).2013 \equiv 3 \pmod{b}.

This means b∣2010b \mid 2010. We also need b≥4b \ge 4 since the digit 33 must be a valid digit in base bb (digits go from 00 to b−1b-1, so b>3b > 3).

Now 2010=2×3×5×672010 = 2 \times 3 \times 5 \times 67. The number of positive divisors of 20102010 is (1+1)4=16(1+1)^4 = 16. Three of these divisors (1,2,31, 2, 3) are less than 44, so the answer is 16−3=1316 - 3 = 13.

Example 3

What is the sum of the digits of 999999 in base 88?

First convert, 999=124(8)+7999 = 124(8) + 7, then 124=15(8)+4124 = 15(8) + 4, then 15=1(8)+715 = 1(8) + 7, then 1=0(8)+11 = 0(8) + 1.

So 999=17478999 = 1747_8.

The digit sum is 1+7+4+7=191 + 7 + 4 + 7 = 19.

Key Contest Insight

The connection between bases and modular arithmetic is the single most important idea:

  • The last digit of NN in base bb equals N mod bN \bmod b.
  • The last kk digits of NN in base bb encode N mod bkN \bmod b^k.
  • The digit sum in base bb relates to N mod (b−1)N \bmod (b-1).

Whenever a problem mentions a specific base, ask yourself what modular information the base representation is encoding.

Strategy Tips

  • When a problem asks about a number's representation in an unknown base bb, translate digit conditions into divisibility or modular conditions on bb.
  • To count integers whose base bb digits satisfy some restriction, think of each digit position as an independent choice (possibly with constraints on the leading digit).
  • Base 22 representations connect naturally to subsets, each subset of {1,2,…,n}\{1, 2, \ldots, n\} corresponds to an nn digit binary string.
  • If a problem involves both base bb and base cc, rewrite everything in base 1010 to find common ground, then work modularly.

Common Pitfalls

  • Forgetting that digits in base bb must satisfy 0≤ai≤b−10 \le a_i \le b-1. The digit 33 does not exist in base 33.
  • Reading remainders in the wrong order when converting from base 1010 to base bb. Remainders are read bottom to top.
  • Confusing 'the number 123123 in base 55' (which equals 3838 in base 1010) with 'the number 123123 converted to base 55.'
  • Assuming a number has the same number of digits in every base.

Practice Problems

StatusSourceProblem NameDifficultyTags

Module Progress:

Join the Discord Community!

Stuck on a problem, or don't understand a module? Join the Discord and get help with your doubts while making more math friends.