Olympiad Maths Prep

Track / Stage 3 / 212 of 260 #212 of 2000

Problem 212

AMC 10/12, early questions
Number theory Difficulty 3.8 Find the answer

How many nonnegative integers can be written in the form a737+a636+a535+a434+a333+a232+a131+a030,a_7\cdot3^7+a_6\cdot3^6+a_5\cdot3^5+a_4\cdot3^4+a_3\cdot3^3+a_2\cdot3^2+a_1\cdot3^1+a_0\cdot3^0,
where ai{1,0,1}a_i\in \{-1,0,1\} for 0i70\le i \le 7?
(A) 512(B) 729(C) 1094(D) 3281(E) 59,048\textbf{(A) } 512 \qquad \textbf{(B) } 729 \qquad \textbf{(C) } 1094 \qquad \textbf{(D) } 3281 \qquad \textbf{(E) } 59,048

Official solutions — 2

Solution 1

This looks like balanced ternary, in which all the integers with absolute values less than 3n2\frac{3^n}{2} are represented in nn digits. There are 8 digits. Plugging in 8 into the formula for the balanced ternary gives a maximum bound of x=3280.5|x|=3280.5, which means there are 3280 positive integers, 0, and 3280 negative integers. Since we want all nonnegative integers, there are 3280+1=32813280+1=\boxed{3281} integers or D\boxed{\textbf{D}}.

Solution 2

1. We are given the expression:
a737+a636+a535+a434+a333+a232+a131+a030 a_7 \cdot 3^7 + a_6 \cdot 3^6 + a_5 \cdot 3^5 + a_4 \cdot 3^4 + a_3 \cdot 3^3 + a_2 \cdot 3^2 + a_1 \cdot 3^1 + a_0 \cdot 3^0
where ai{1,0,1}a_i \in \{-1, 0, 1\} for 0i70 \leq i \leq 7.

2. We need to determine how many distinct nonnegative integers can be formed by this expression.

3. First, note that each aia_i has 3 possible values: 1-1, 00, and 11. Therefore, there are 383^8 total combinations of the coefficients a0,a1,,a7a_0, a_1, \ldots, a_7.

4. To ensure that all these combinations lead to distinct integers, consider the following:
- Suppose two different sets of coefficients, say {ai}\{a_i\} and {bi}\{b_i\}, produce the same integer. Let jj be the largest index where ajbja_j \neq b_j. Without loss of generality, assume aj>bja_j > b_j.
- The difference between the two representations is:
(ajbj)3j+(aj1bj1)3j1++(a0b0)30 (a_j - b_j) \cdot 3^j + (a_{j-1} - b_{j-1}) \cdot 3^{j-1} + \ldots + (a_0 - b_0) \cdot 3^0
- The terms from 00 to j1j-1 sum up to a number that is at least:
2(3j1+3j2++30)=2(3j12)=3j+1 -2 \left(3^{j-1} + 3^{j-2} + \ldots + 3^0\right) = -2 \left(\frac{3^j - 1}{2}\right) = -3^j + 1
- Therefore, the whole sum is at least 11, which contradicts the assumption that the two sets of coefficients produce the same integer. Hence, all combinations lead to distinct integers.

5. Next, we need to count the number of nonnegative integers that can be formed. We use a recurrence relation to solve this problem:
- Let cnc_n denote the number of nonnegative integers that can be formed using coefficients up to ana_n.
- For n=0n = 0, the possible values are 1,0,1-1, 0, 1. Only 00 and 11 are nonnegative, so c0=2c_0 = 2.

6. For n>0n > 0, consider the possible values of an+1a_{n+1}:
- If an+1=1a_{n+1} = -1, the sum of the remaining terms can be at most 3n+112\frac{3^{n+1} - 1}{2}, making the total sum negative.
- If an+1=0a_{n+1} = 0, the problem reduces to the case for nn, so there are cnc_n nonnegative values.
- If an+1=1a_{n+1} = 1, the sum of the remaining terms can be at least 3n+112-\frac{3^{n+1} - 1}{2}, making the total sum positive. There are 3n+13^{n+1} choices here.

7. Therefore, the recurrence relation is:
cn+1=cn+3n+1 c_{n+1} = c_n + 3^{n+1}

8. Solving this recurrence relation with c0=2c_0 = 2:
c1=c0+31=2+3=5 c_1 = c_0 + 3^1 = 2 + 3 = 5
c2=c1+32=5+9=14 c_2 = c_1 + 3^2 = 5 + 9 = 14
c3=c2+33=14+27=41 c_3 = c_2 + 3^3 = 14 + 27 = 41
c4=c3+34=41+81=122 c_4 = c_3 + 3^4 = 41 + 81 = 122
c5=c4+35=122+243=365 c_5 = c_4 + 3^5 = 122 + 243 = 365
c6=c5+36=365+729=1094 c_6 = c_5 + 3^6 = 365 + 729 = 1094
c7=c6+37=1094+2187=3281 c_7 = c_6 + 3^7 = 1094 + 2187 = 3281

9. Thus, the number of nonnegative integers that can be written in the given form is 3281\boxed{3281}.

Source: NuminaMath-1.5, licensed Apache-2.0. Statement and solution reproduced as published; topic, difficulty and ordering added by this site.