Skip to content
Number Theory · Chapter 28

Miscellaneous Number Theory

Palindromes, coin problems and a grab bag of number-theory tricks: pair numbers up, find the largest total two coins can't make, and spot patterns in digits and grids.

You'll need
open on YouTube
28.10%

Palindromes

In this section you will be able to build palindromes digit by digit, and use their place values to find means and divisibility.

Pair 101101 with 999999, then 111111 with 989989, then 121121 with 979979. Every pair adds to 11001100, so each pair averages 550550. That is the mean of all three-digit palindromes, with no big sum needed.

A palindrome is fixed by its first half. The second half just copies it in mirror order. So a three-digit palindrome aba‾\overline{aba} has 9⋅10=909 \cdot 10 = 90 choices.

Look: write a palindrome in place values. aba‾=101a+10b\overline{aba} = 101a + 10b and abba‾=1001a+110b\overline{abba} = 1001a + 110b. Since 1001=7⋅11⋅131001 = 7 \cdot 11 \cdot 13 and 110=10⋅11110 = 10 \cdot 11, every four-digit palindrome is a multiple of 1111.

Exploreplay first, formulas later

3-digit palindromes: choose the first 2 digits, 9 × 10 = 90

digits3

Tap a solid slot to change it. Dashed slots copy their mirror twin.

9 × 10 = 90 3-digit palindromes

383 is a palindrome. 3-digit palindromes: 9 × 10 = 90

Name it

Definition 28.1.1 · Palindrome

A palindrome is a number that reads the same forward and backward, such as 777777, 383383 or 1595115951.

Watch itpredict, then reveal

Example 28.1

AIME

Find the arithmetic mean of all the three-digit palindromes. (Recall that a palindrome is a number that reads the same forward and backward, such as 777777 or 383383.)

Palindrome builder (its total is revealed at the end of the example)

digits3

Tap a solid slot to change it. Dashed slots copy their mirror twin.

Complement

101 + 999 = 1,100

Every 3-digit palindrome pairs up like this, so the mean is 1,100 ÷ 2 = ? (hidden until the end of the example)

9 × 10 = 90 3-digit palindromes

101 is a palindrome. 3-digit palindromes: 9 × 10 = 90 Palindrome + complement = 1,100; mean ?.

  1. 1

    A three-digit palindrome looks like aba‾\overline{aba}. You choose aa (not 00) and bb. How many three-digit palindromes are there?

    Predict first:

Try it

Problem 28.3.2

AMC 10

Driving along a highway, Megan noticed that her odometer showed 1595115951 (miles). This number is a palindrome: it reads the same forward and backward. Then 22 hours later, the odometer displayed the next higher palindrome. What was her average speed, in miles per hour, during this 22-hour period?

Problem 28.3.3

AMC 10

A palindrome, such as 8343883438, is a number that remains the same when its digits are reversed. The numbers xx and x+32x + 32 are three-digit and four-digit palindromes, respectively. What is the sum of the digits of xx?

Problem 28.3.8(additional)

AMC 10

How many 77-digit palindromes (numbers that read the same backward as forward) can be formed using the digits 2,2,3,3,5,5,52, 2, 3, 3, 5, 5, 5?

Contest cornerreal contest problems

Problem 28.3.7(additional)

AMC 10/12

A palindrome between 10001000 and 10,00010{,}000 is chosen at random. What is the probability that it is divisible by 77?

4-digit palindromes: choose the first 2 digits, 9 × 10 = 90. 18 of the 90 4-digit palindromes are divisible by 7

digits4
divide by7

Tap a solid slot to change it. Dashed slots copy their mirror twin.

1,001 = 7 × 143: divisible by 7.

Divisible by 7: ? (hidden until the end of the example) of 90 4-digit palindromes

9 × 10 = 90 4-digit palindromes
9×101=909 \times 10^{1} = 90

Place value: abba‾=1001a+110b\overline{abba} = 1001a + 110b

1001 is a palindrome. 4-digit palindromes: 9 × 10 = 90 Divisible by 7: ? of 90 palindromes.

Problem 28.3.10(additional)

AMC 12

A palindrome is a nonnegative integer number that reads the same forwards and backwards when written in base 1010 with no leading zeros. A 66-digit palindrome nn is chosen uniformly at random. What is the probability that n11\dfrac{n}{11} is also a palindrome?

6-digit palindromes: choose the first 3 digits, 9 × 10 × 10 = 900. 900 of the 900 6-digit palindromes are divisible by 11

digits6
divide by11

Tap a solid slot to change it. Dashed slots copy their mirror twin.

123,321 = 11 × 11,211: divisible by 11.

Divisible by 11: 900 of 900 6-digit palindromes

9 × 10 × 10 = 900 6-digit palindromes
9×102=9009 \times 10^{2} = 900

Place value: abccba‾=100001a+10010b+1100c\overline{abccba} = 100001a + 10010b + 1100c

123321 is a palindrome. 6-digit palindromes: 9 × 10 × 10 = 900 Divisible by 11: 900 of 900 palindromes.

Checkpoint for section 28.1

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

How many five-digit palindromes are there?

2

What is the arithmetic mean of all four-digit palindromes?

3

Every four-digit palindrome abba‾\overline{abba} is divisible by which of these numbers?

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

Chicken McNugget Theorem

In this section you will be able to find the largest total two coin sizes can't make, and count the totals they miss.

You only have 33-cent and 55-cent coins. You can pay 88, 99 and 1010 cents. Then you can pay everything after that: just add another 33. So 77 is the largest amount you can never pay.

With two coin sizes aa and bb that share no factor, the largest amount you can’t make is ab−a−bab - a - b. Once you can make aa amounts in a row, adding aa again and again reaches every larger amount.

Look: if aa and bb share a factor, like 44 and 66, every total is even. Then infinitely many amounts are missed, and the theorem does not apply.

The last example in this section is a different kind of number puzzle: spot a digit pattern in small cases first.

Exploreplay first, formulas later

Packs of 3 and 5: the largest total you can't make is 3·5 − 3 − 5 = 7; 4 positive totals can't be made

pack a3
pack b5

Predict first: which numbers can you make? Then fill in.

check a number11
11 = 2 × 3 + 1 × 5
Find the largest total you can't make.

Packs of 3 and 5. 11 = 2 × 3 + 1 × 5. Find the largest total you can't make.

Name it

Theorem 28.2.1 · Chicken McNugget Theorem

If aa and bb are relatively prime positive integers, the largest number that cannot be written as a sum of non-negative multiples of aa and bb is

ab−a−b.ab - a - b.

Moreover, exactly

(a−1)(b−1)2\frac{(a - 1)(b - 1)}{2}

positive integers cannot be written in the form ma+nbma + nb with mm and nn non-negative integers.

Remark 28.2.2

This theorem is useful for problems like "the largest amount of money that can't be made with 33-cent and 55-cent coins".

Watch itpredict, then reveal

Example 28.2

AMC 10

The town of Hamlet has 33 people for each horse, 44 sheep for each cow, and 33 ducks for each person. Which of the following could not possibly be the total number of people, horses, sheep, cows, and ducks in Hamlet?

  1. (A)4141
  2. (B)4747
  3. (C)5959
  4. (D)6161
  5. (E)6666

Coin reach (its total is revealed at the end of the example)

pack a13
pack b5

Predict first: which numbers can you make? Then fill in. Ringed numbers are the ones to test.

check a number41
41 = 2 × 13 + 3 × 5
Find the largest total you can't make.

Packs of 13 and 5. 41 = 2 × 13 + 3 × 5. Find the largest total you can't make.

  1. 1

    Say there are hh horses and cc cows. Then there are 3h3h people. How many ducks are there for each horse?

    Predict first:

Example 28.3

AMC 10

The product (8)(888…8)(8)(888\ldots8), where the second factor has kk digits, is an integer whose digits have a sum of 10001000. What is kk?

  1. (A)901901
  2. (B)911911
  3. (C)919919
  4. (D)991991
  5. (E)999999
  1. 1

    Try small cases first.

    kk product digit sum
    11 8⋅8=648 \cdot 8 = 64 1010
    22 8⋅88=7048 \cdot 88 = 704 1111
    33 8⋅888=71048 \cdot 888 = 7104 1212
    44 8⋅8888=711048 \cdot 8888 = 71104 1313

    What is 8⋅888888 \cdot 88888?

    Predict first:

Contest cornerreal contest problems

Problem 28.3.13(additional)

AIME

Ninety-four bricks, each measuring 4′′×10′′×19′′4'' \times 10'' \times 19'', are to be stacked one on top of another to form a tower 9494 bricks tall. Each brick can be oriented so it contributes 4′′4'' or 10′′10'' or 19′′19'' to the total height of the tower. How many different tower heights can be achieved using all ninety-four of the bricks?

Problem 28.3.16(additional)

AIMEChallenge

Find the sum of all positive integers nn such that, given an unlimited supply of stamps of denominations 55, nn, and n+1n + 1 cents, 9191 cents is the greatest postage that cannot be formed.

Packs of 5, 24 and 25: the largest total you can't make is 91; 46 positive totals can't be made

pack a5
pack b24
pack c25

Predict first: which numbers can you make? Then fill in.

check a number11
11 can't be made from packs of 5, 24 and 25
Find the largest total you can't make.

Packs of 5, 24 and 25. 11 can't be made from packs of 5, 24 and 25. Find the largest total you can't make.

Checkpoint for section 28.2

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

Stamps come in 44-cent and 77-cent values. What is the largest postage that cannot be made?

2

How many positive integers cannot be written as 5m+8n5m + 8n with m,nm, n non-negative integers?

3

In Coinland, coins are worth 66, 1010 and 1515 cents. There is no formula for three coins, so use the grid below. What is the most expensive item that cannot be paid for exactly?

Packs of 6, 10 and 15: the largest total you can't make is 29; 15 positive totals can't be made

pack a6
pack b10
pack c15

Predict first: which numbers can you make? Then fill in.

check a number11
11 can't be made from packs of 6, 10 and 15
Find the largest total you can't make.

Packs of 6, 10 and 15. 11 can't be made from packs of 6, 10 and 15. Find the largest total you can't make.

28.3

Practice Problems

In this section you will be able to mix palindromes, coin problems, games and digit patterns on contest problems.

These problems don’t share one big idea. They share a habit: try small cases, find the pattern, then prove it.

Write out the first few rows, piles or squares before you compute anything big. Spirals, games and floor sums all repeat in a way you can see after a few steps.

Contest cornerreal contest problems

Problem 28.3.1

AMC 12B

Suppose

2+11+12+23+x=14453.2 + \cfrac{1}{1 + \cfrac{1}{2 + \cfrac{2}{3 + x}}} = \frac{144}{53}.

What is the value of xx?

Problem 28.3.4

AMC 10

Mr. Zhou places all the integers from 11 to 225225 into a 1515 by 1515 grid. He places 11 in the middle square (eighth row and eighth column) and places other numbers one by one clockwise, as shown in part in the diagram below. What is the sum of the greatest number and the least number that appear in the second row from the top?

Problem 28.3.5

AMC 10/12

A set of numbers is called sum-free if whenever xx and yy are (not necessarily distinct) elements of the set, x+yx + y is not an element of the set. For example, {1,4,6}\{1, 4, 6\} and the empty set are sum-free, but {2,4,5}\{2, 4, 5\} is not. What is the greatest possible number of elements in a sum-free subset of {1,2,3,…,20}\{1, 2, 3, \ldots, 20\}?

Problem 28.3.6

AMC 12Challenge

Let d(n)d(n) denote the number of positive integers that divide nn, including 11 and nn. For example, d(1)=1d(1) = 1, d(2)=2d(2) = 2, and d(12)=6d(12) = 6. (This function is known as the divisor function.) Let

f(n)=d(n)n3.f(n) = \frac{d(n)}{\sqrt[3]{n}}.

There is a unique positive integer NN such that f(N)>f(n)f(N) > f(n) for all positive integers n≠Nn \ne N. What is the sum of the digits of NN?

Problem 28.3.9(additional)

AIME

Alice and Bob are playing a game with nn coins in a pile. Every turn, a player can take 11 or 44 coins from the pile, and Alice goes first. The player that takes the last coin wins. How many values of nn less than or equal to 20242024 are there such that no matter what Alice does, Bob has a winning strategy?

Problem 28.3.11(additional)

AMC 10

What is the ones digit of the sum

⌊1⌋+⌊2⌋+⌊3⌋+⋯+⌊2025⌋?\lfloor \sqrt{1} \rfloor + \lfloor \sqrt{2} \rfloor + \lfloor \sqrt{3} \rfloor + \cdots + \lfloor \sqrt{2025} \rfloor?

(Recall that ⌊x⌋\lfloor x \rfloor represents the greatest integer less than or equal to xx.)

Problem 28.3.12(additional)

AMC 10

This problem also appears in the book as 21.3.18.

Joey and Chloe and their daughter Zoe all have the same birthday. Joey is 11 year older than Chloe, and Zoe is exactly 11 year old today. Today is the first of the 99 birthdays on which Chloe's age will be an integral multiple of Zoe's age. What will be the sum of the two digits of Joey's age the next time his age is a multiple of Zoe's age?

Problem 28.3.14(additional)

AMC 10

Let NN be the positive integer 7777…7777777\ldots777, a 313313-digit number where each digit is a 77. Let f(r)f(r) be the leading digit of the rrth root of NN. What is

f(2)+f(3)+f(4)+f(5)+f(6)?f(2) + f(3) + f(4) + f(5) + f(6)?

Problem 28.3.15(additional)

AMC 10

An array of numbers is constructed beginning with the numbers −131-1 \quad 3 \quad 1 in the top row. Each adjacent pair of numbers is summed to produce a number in the next row. Each row begins and ends with −1-1 and 11, respectively.

−131−1241−11651\begin{array}{ccccccccc} & & -1 & & 3 & & 1 & & \\ & -1 & & 2 & & 4 & & 1 & \\ -1 & & 1 & & 6 & & 5 & & 1 \end{array}

If the process continues, one of the rows will sum to 12,28812{,}288. In that row, what is the third number from the left?