Can $2017$ be written as sum of two elements of a certain set? $A_1=\{1\},$ $A_{n+1}=\{3k,3k+1 \text{ for } k \in A_n\},$ $n \in\mathbb N$ and $A$ is the union of all $A_n.$ Can $2017$ be written as sum of two elements of $A$?
I am basically clueless about how to proceed . Some suggestions would be helpful and is the representation unique?
 A: Hint:
The hint for this problem is to look at the elements of $A_n$ in ternary (base-3). 

Solution:
The hint is motivated from the construction of $A_n$, which requires multiplying by $3$ (which adds a $0$ to the right side of a number in base-3) and adding 0 or 1 only changes the last digit in base-3.
Note that in ternary, $A_1 = \{1\}$, $A_2 = \{10, 11\}$, $A_3 = \{100, 101, 110, 111\}$, etc. We thus note that only numbers with digits in $\{0, 1\}$ appear in $A$ and all numbers of this form must appear. This is easily proven via induction on the size of the set and noting that the digit $2$ can never appear in a number.
We further note that $2017 = 2202201_3$, so if two numbers in $A$ (let's call them $\overline{a_6a_5a_4a_3a_2a_1a_0}$ and $\overline{b_6b_5a_4b_3b_2b_1b_0}$) add to $2017$, we must have $a_i, b_i \in \{0, 1\}$. Thus, we get that no carrying occurs.
Solving this, we get $a_6 = b_6 = 1$, $a_5 = b_5 = 1$, $a_4 = b_4 = 0$, $a_3 = b_3 = 1$, $a_2 = b_2 = 1$, $a_1 = b_1 = 0$, and $(a_0, b_0) \in \{(0, 1), (1, 0)\}$.
This gives the two numbers uniquely as $1101100_3 = 1008$ and $1101101_3 = 1009$, so we're done.
Therefore, there exist 2 unique numbers in $A$ with a sum equal to $2017$ - $1008$ and $1009$.
