Skip to content
Number Theory · Chapter 27

Bases

Every base is a regrouping rule: expand a numeral into powers of its base, then solve for digits or take a mod to read off remainders.

You'll need
open on YouTube
27.00%

Place Value in Any Base

In this section you will be able to read a numeral in any base as a polynomial in the base, convert both ways, and get remainders without converting.

Is 27,006,000,052927{,}006{,}000{,}052_{9} divisible by 55? You don’t need to convert all eleven digits. You only need to know what 99 is mod 55.

A base is a regrouping rule. Base 10 carries at ten; base bb carries at bb. So each place is worth a power of bb, and a numeral is a polynomial in bb: (a2a1a0)b=a2b2+a1b+a0(a_2 a_1 a_0)_b = a_2 b^2 + a_1 b + a_0.

Two moves solve most contest problems. Expand the numeral into its polynomial and solve for the digits. Digits are whole numbers from 00 to b−1b - 1, which is a strong condition. Or reduce the base mod mm to find remainders without converting.

Look:

b≡1(modb−1)b \equiv 1 \pmod{b - 1}, so a base-bb number leaves the same remainder mod b−1b - 1 as its digit sum. That is the “divisible by 9” rule, in any base.

Exploreplay first, formulas later

44 in base 5 = 24 in base 10

base b5
mod moff
0525^{2}
4515^{1}
4505^{0}
445 = 24

44 in base 5 = 24

Name it

Definition 27.0.1 · Bases

A number expressed in base-nn is similar to base 1010, except that instead of regrouping to a new place value every 1010, we regroup every nn.

Concept 27.0.2 · Place Value in Base $n$

A number in base nn with digits am,am−1,…,a2,a1,a0a_m, a_{m-1}, \ldots, a_2, a_1, a_0 can be written as

(amam−1…a2a1a0)n.\left(a_m a_{m-1} \ldots a_2 a_1 a_0\right)_n.

This number can be evaluated as

amnm+am−1nm−1+⋯+a2n2+a1n1+a0n0.a_m n^m + a_{m-1} n^{m-1} + \cdots + a_2 n^2 + a_1 n^1 + a_0 n^0.

Concept 27.0.3 · Base-$n$ Fractions

We can also have bases with decimals, both repeating and terminating.

A number in base nn with digits am,am−1,…,a1,a0a_m, a_{m-1}, \ldots, a_1, a_0 before the point and digits a−1,a−2,…,a−qa_{-1}, a_{-2}, \ldots, a_{-q} after the point can be written as

(amam−1…a1a0 . a−1a−2…a−q)n.\left(a_m a_{m-1} \ldots a_1 a_0 \,.\, a_{-1} a_{-2} \ldots a_{-q}\right)_n.

This number can be evaluated as

amnm+am−1nm−1+⋯+a1n1+a0n0+a−1n−1+a−2n−2+⋯+a−qn−q.a_m n^m + a_{m-1} n^{m-1} + \cdots + a_1 n^1 + a_0 n^0 + a_{-1} n^{-1} + a_{-2} n^{-2} + \cdots + a_{-q} n^{-q}.

Watch itpredict, then reveal

Example 27.1

AMC 10/12

The base-nine representation of the number NN is 27,006,000,052nine27{,}006{,}000{,}052_{\text{nine}}. What is the remainder when NN is divided by 55?

Base odometer (its total is revealed at the end of the example)

base b9
mod moff
29109^{10}
7999^{9}
0989^{8}
0979^{7}
6969^{6}
0959^{5}
0949^{4}
0939^{3}
0929^{2}
5919^{1}
2909^{0}
270060000529 = ? (hidden until the end of the example)

27006000052 in base 9 = ?

  1. 1

    Converting all eleven digits is slow. Instead: what is the remainder of 99 when divided by 55?

    Predict first:
open on YouTube

Example 27.2

AIME

Find the three-digit positive integer a‾ b‾ c‾\underline{a}\,\underline{b}\,\underline{c} whose representation in base nine is b‾ c‾ a‾ nine\underline{b}\,\underline{c}\,\underline{a}_{\,\text{nine}}, where aa, bb, and cc are (not necessarily distinct) digits.

Base odometer (its total is revealed at the end of the example)

base b9
mod moff
1929^{2}
0919^{1}
0909^{0}
1009 = 81

The same digits read in base 10: 100

100 in base 9 = 81

  1. 1

    Expand both numerals by place value. What is b‾ c‾ a‾ nine\underline{b}\,\underline{c}\,\underline{a}_{\,\text{nine}} worth?

    Predict first:
    Click a choice or type its letter (A–E).
open on YouTube

Example 27.3

AMC 10

A base-10 three-digit number nn is selected at random. Which of the following is closest to the probability that the base-9 representation and the base-11 representation of nn are both three-digit numerals?

  1. (A)0.30.3
  2. (B)0.40.4
  3. (C)0.50.5
  4. (D)0.60.6
  5. (E)0.70.7

Base odometer (its total is revealed at the end of the example)

first base9
second base11
digits3
  • Window: 100–999
  • Base 9: 3 digits for 81–728
  • Base 11: 3 digits for 121–1,330
  • Both, inside the window: ?–?
? (hidden until the end of the example)

Base 9 and base 11 both fit: ? numbers

  1. 1

    Which numbers have exactly three digits in base 99? Give the largest.

    Predict first:
open on YouTube

Example 27.4

AMC 12

For some positive integer kk, the repeating base-kk representation of the (base-ten) fraction 751\frac{7}{51} is 0.23‾k=0.232323…k0.\overline{23}_k = 0.232323\ldots_k. What is kk?

Base odometer (its total is revealed at the end of the example)

base b10
210−110^{-1}
310−210^{-2}
0.23‾10=23102−1=23990.\overline{23}_{10} = \tfrac{23}{10^{2} - 1} = \tfrac{23}{99}≈ 0.23232323

Target 7/51: ? (hidden until the end of the example)

0.(23) repeating in base 10 = 23/99

  1. 1

    By Concept 27.0.3, what is the first block 0.23k0.23_k worth?

open on YouTube

Try it

Problem 27.1.1

AMC 10

In base 1010, the number 20132013 ends in the digit 33. In base 99, on the other hand, 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?

Problem 27.1.5

AMC 10

For which of the following integers bb is the base-bb number 2021b−221b2021_b - 221_b not divisible by 33?

0 in base 8 = 0 in base 10; remainder 0 mod 3

base b8
mod m3
0838^{3}≡2
0828^{2}≡1
0818^{1}≡2
0808^{0}≡1
08 = 0

Each place value is replaced by its remainder mod 3:

0 = 0

remainder mod 3: 0

0 in base 8 = 0

Click a choice or type its letter (A–E).

Problem 27.1.6

AMC 10

Let nn be a positive integer and dd be a digit such that the value of the numeral 32d‾\underline{32d} in base nn equals 263263, and the value of the numeral 324‾\underline{324} in base nn equals the value of the numeral 11d1‾\underline{11d1} in base six. What is n+dn + d?

Contest cornerreal contest problems

Problem 27.1.2

AMC 10

Hexadecimal (base-16) numbers are written using numeric digits 00 through 99 as well as the letters AA through FF to represent 1010 through 1515. Among the first 10001000 positive integers, there are nn whose hexadecimal representation contains only numeric digits. What is the sum of the digits of nn?

3E8 in base 16 = 1,000 in base 10

base b16
mod moff
316216^{2}
E16116^{1}
816016^{0}
3E816 = 1,000

3E8 in base 16 = 1,000

Problem 27.1.4

AIME

A positive integer NN has base-eleven representation a‾ b‾ c‾\underline{a}\,\underline{b}\,\underline{c} and base-eight representation 1‾ b‾ c‾ a‾\underline{1}\,\underline{b}\,\underline{c}\,\underline{a}, where aa, bb, and cc represent (not necessarily distinct) digits. Find the least such NN expressed in base ten.

Problem 27.1.11(additional)

AIME

The number nn can be written in base 1414 as a‾ b‾ c‾\underline{a}\,\underline{b}\,\underline{c}, can be written in base 1515 as a‾ c‾ b‾\underline{a}\,\underline{c}\,\underline{b}, and can be written in base 66 as a‾ c‾ a‾ c‾\underline{a}\,\underline{c}\,\underline{a}\,\underline{c}, where a>0a > 0. Find the base-10 representation of nn.

Problem 27.1.12(additional)

AIME

Call a positive integer NN a 7-10 double\textit{7-10 double} if the digits of the base-77 representation of NN form a base-1010 number that is twice NN. For example, 5151 is a 7-10 double because its base-77 representation is 102102. What is the largest 7-10 double?

102 in base 7 = 51 in base 10; the same digits read in base 10 give 102

base b7
mod moff
1727^{2}
0717^{1}
2707^{0}
1027 = 51

The same digits read in base 10: 102= 2 × the value

102 in base 7 = 51

Problem 27.1.13(additional)

AIME

Let NN be the number of positive integers that are less than or equal to 20032003 and whose base-22 representation has more 11's than 00's. Find the remainder when NN is divided by 10001000.

11111010011 in base 2 = 2,003 in base 10

base b2
mod moff
12102^{10}
1292^{9}
1282^{8}
1272^{7}
1262^{6}
0252^{5}
1242^{4}
0232^{3}
0222^{2}
1212^{1}
1202^{0}
111110100112 = 2,003

11111010011 in base 2 = 2,003

Problem 27.1.15(additional)

AIME

Find the number of positive integers less than or equal to 20172017 whose base-three representation contains no digit equal to 00.

Checkpoint for section 27.0

Get 2 of 3 right to master this section. One try each, no hints.
1

What is 123451234_5 in base 1010?

2

What is the remainder when 121212131212121_3 is divided by 44?

3

Write the repeating base-55 number 0.3‾5=0.333…50.\overline{3}_5 = 0.333\ldots_5 as a fraction in base 1010.

27.1

Practice Problems

In this section you will be able to combine place value, digit limits and mods on harder base problems.

Time to mix the moves. Each problem hides a polynomial in some base: expand it, use the digit limits, or take a mod. Every problem has three hints if you get stuck.

Want every problem from this chapter on one page? Open the problem set.

Mixed practice

Problem 27.1.7(additional)

AMC 10

This problem also appears in the book as 27.1.6.

Let nn be a positive integer and dd be a digit such that the value of the numeral 32d‾\underline{32d} in base nn equals 263263, and the value of the numeral 324‾\underline{324} in base nn equals the value of the numeral 11d1‾\underline{11d1} in base six. What is n+dn + d?

Problem 27.1.8(additional)

AMC 10

This problem also appears in the book as 27.1.5.

For which of the following integers bb is the base-bb number 2021b−221b2021_b - 221_b not divisible by 33?

Click a choice or type its letter (A–E).

Problem 27.1.9(additional)

AMC 10

What is the greatest possible sum of the digits in the base-seven representation of a positive integer less than 20192019?

Problem 27.1.10(additional)

AMC 12

In the equation below, AA and BB are consecutive positive integers, and AA, BB, and A+BA + B represent number bases:

132A+43B=69A+B.132_A + 43_B = 69_{A+B}.

What is A+BA + B?

Contest cornerreal contest problems

Problem 27.1.3

AIME

For each positive integer nn, let f(n)f(n) be the sum of the digits in the base-four representation of nn and let g(n)g(n) be the sum of the digits in the base-eight representation of f(n)f(n). For example, f(2020)=f(1332104)=10=128f(2020) = f(133210_{\text{4}}) = 10 = 12_{\text{8}}, and g(2020)=the digit sum of 128=3g(2020) = \text{the digit sum of } 12_{\text{8}} = 3. Let NN be the least value of nn such that the base-sixteen representation of g(n)g(n) cannot be expressed using only the digits 00 through 99. Find the remainder when NN is divided by 10001000.

Problem 27.1.14(additional)

AIME

A rational number written in base eight is a‾ b‾ . c‾ d‾\underline{a}\,\underline{b}\,.\,\underline{c}\,\underline{d}, where all digits are nonzero. The same number in base twelve is b‾ b‾ . b‾ a‾\underline{b}\,\underline{b}\,.\,\underline{b}\,\underline{a}. Find the base-ten number a‾ b‾ c‾\underline{a}\,\underline{b}\,\underline{c}.

0.00 in base 8 = 0

base b8
0818^{1}
0808^{0}
.
08−18^{-1}
08−28^{-2}
0.008 = 0

0.00 in base 8 = 0

Problem 27.1.16(additional)

AIME

This problem also appears in the book as 27.1.11.

The number nn can be written in base 1414 as a‾ b‾ c‾\underline{a}\,\underline{b}\,\underline{c}, can be written in base 1515 as a‾ c‾ b‾\underline{a}\,\underline{c}\,\underline{b}, and can be written in base 66 as a‾ c‾ a‾ c‾\underline{a}\,\underline{c}\,\underline{a}\,\underline{c}, where a>0a > 0. Find the base-10 representation of nn.

Problem 27.1.17(additional)

AIME

Find the sum of all positive integers b<1000b < 1000 such that the base-bb integer 36b36_b is a perfect square and the base-bb integer 27b27_b is a perfect cube.

Problem 27.1.18(additional)

AIME

This problem also appears in the book as 27.1.4.

A positive integer NN has base-eleven representation a‾ b‾ c‾\underline{a}\,\underline{b}\,\underline{c} and base-eight representation 1‾ b‾ c‾ a‾\underline{1}\,\underline{b}\,\underline{c}\,\underline{a}, where aa, bb, and cc represent (not necessarily distinct) digits. Find the least such NN expressed in base ten.

Problem 27.1.19(additional)

AIME

There exist rr unique nonnegative integers n1>n2>⋯>nrn_1 > n_2 > \cdots > n_r and rr unique integers aka_k (1≤k≤r1 \le k \le r) with each aka_k either 11 or −1-1 such that

a13n1+a23n2+⋯+ar3nr=2008.a_1 3^{n_1} + a_2 3^{n_2} + \cdots + a_r 3^{n_r} = 2008.

Find n1+n2+⋯+nrn_1 + n_2 + \cdots + n_r.

0 in balanced ternary = 0

0373^{7}
0363^{6}
0353^{5}
0343^{4}
0333^{3}
0323^{2}
0313^{1}
0303^{0}

Digits are −1, 0 and 1. Every integer has exactly one such form.

00 = 0

Target 2,008: +2,008 to go

0 in balanced ternary: 0

Problem 27.1.20(additional)

AIME

This problem also appears in the book as 27.1.3.

For each positive integer nn, let f(n)f(n) be the sum of the digits in the base-four representation of nn and let g(n)g(n) be the sum of the digits in the base-eight representation of f(n)f(n). For example, f(2020)=f(1332104)=10=128f(2020) = f(133210_{\text{4}}) = 10 = 12_{\text{8}}, and g(2020)=the digit sum of 128=3g(2020) = \text{the digit sum of } 12_{\text{8}} = 3. Let NN be the least value of nn such that the base-sixteen representation of g(n)g(n) cannot be expressed using only the digits 00 through 99. Find the remainder when NN is divided by 10001000.

Problem 27.1.21(additional)

AMC 10Challenge

Bernardo chooses a three-digit positive integer NN and writes both its base-55 and base-66 representations on a blackboard. Later LeRoy sees the two numbers Bernardo has written. Treating the two numbers as base-1010 integers, he adds them to obtain an integer SS. For example, if N=749N = 749, Bernardo writes the numbers 10,44410{,}444 and 3,2453{,}245, and LeRoy obtains the sum S=13,689S = 13{,}689. For how many choices of NN are the two rightmost digits of SS, in order, the same as those of 2N2N?