2018 AMC 10A Problem 18
How many nonnegative integers can be written in the form where for ?
Show solution without answering
Key insight
Digits -1, 0, 1 with powers of 3 make every whole number from -3280 to 3280 exactly once; the nonnegative ones are 0 through 3280.
Solution
There are digits, each with choices, so digit strings. We need to know which numbers they make.
1. Try a small case first. With only two digits, , the nine strings give
Nine strings, nine different numbers, and they fill the whole run from to with no gaps. Of these, are nonnegative: numbers.
2. Largest and smallest with digits. The largest value uses all s:
The smallest uses all s and gives .
3. Different strings give different numbers. Suppose two strings gave the same number. Find the lowest position where their digits differ. Subtract the two numbers: the positions below it cancel, that position leaves or times its power of , and every higher position leaves a multiple of the next power of . A number like or plus a multiple of is never , so the two numbers were not equal after all.
4. So every number in the run is hit. From to there are whole numbers. We have strings making different numbers, all inside that run, so every whole number from to appears exactly once.
5. Count the nonnegative ones. They are , which is numbers.
The answer is .
Why this works
This is like ordinary base , except the digits are instead of . Just as in ordinary base , each string names a different number. Switching the sign of every digit switches the sign of the number, so the values are balanced around : equal numbers of positive and negative values, plus once. That gives .
Alternative approach
Build the pattern from small cases. One digit gives : nonnegative. Two digits give to : nonnegative. Three digits give to : nonnegative. Each count is for digits (, , ), so digits give .
Concise solution
A shorter write-up, the way contest solutions are usually written. It may take a different route from the solution above.
There are choices of the digit string . Two facts settle the count.
All sums are distinct. Suppose two different strings gave the same value. Subtracting, we get with each and not all zero. Look at the smallest index with : every other nonzero term is a multiple of , while is not, so the total cannot be . Contradiction.
The values are symmetric about . Negating every digit negates the sum, so the set of attainable values is closed under . The largest value is , so the distinct values are exactly (that is consecutive integers, so nothing is skipped).
The nonnegative ones are : that is integers.
The answer is .
Review in the AoPS books
- Introduction to Number Theory, Chapter 8: Base Numbers
- Introduction to Counting & Probability, Chapter 1: Counting Is Arithmetic
- Intermediate Counting & Probability, Chapter 4: Constructive Counting and 1-1 Correspondences (§4.4, §4.5, §4.6)
- Introduction to Algebra, Chapter 22: Special Manipulations (§22.3)
Similar problems
Problem © Mathematical Association of America (MAA), American Mathematics Competitions. Reproduced for non-commercial educational use. Solution and commentary are original to this site.