How many nonnegative integers can be written in the form where for ?
- A)
- B)
- C)
- D)
- E)
Answer
D
Key insight
Digits -1, 0, 1 in base 3 (balanced ternary) give every integer from -3280 to 3280 exactly once; by symmetry the nonnegative ones number (3^8 + 1)/2.
Solution
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 .
Why this works
This is balanced ternary: allowing digit instead of still represents each integer uniquely, because each digit string is a different number just as in ordinary base . A count of "how many values" is then a count of digit strings, and the symmetry between a string and its negative splits those strings evenly around zero, with zero itself counted once: .
Alternative approach
Small cases: with digits only, values give nonnegative; with , values to give ; with three digits, to give . The pattern continues to .
The trap
Answering 3^8 = 6561 (all sums, negatives included) or 3^8 / 2 without accounting for zero, or assuming different digit strings can collide.
Common mistakes
- Answering 3^8 = 6561 (all sums, negatives included) or 3^8 / 2 without accounting for zero, or assuming different digit strings can collide.
- Computing the maximum as or as instead of the geometric sum .
Techniques
Map the objects to something easier to count · Exploit symmetry to reduce work or pair up objects