# A problem from elementary number theory

$A=\{1\}$, $A_n=\{3k, 3k+1\}$, where $k$ is in $A_{n-1}$. Let $A$ is the union of $A_n$ where $n=1,2,3,...$. Can $2017$ be written as a sum of two elements of $A$? Is this representation unique?

I have tried this. And with a little calculation I showed that $A$ contains elements of the form $3^n, 3^n+1, 3^n+3^{n-1}+1, 3^n+3^{n-1}+3^2+1$ etc. And with this I was unable to express $2017$ as a sum of two elements of $A$. So I came to the conclusion that $2017$ can't be expressed as a sum. But I don't think this is true. So how to solve it?

• I don't think the definition of $A_n$ is clear. Is $A_1=\{1\}$? (that's not what you wrote). If so, then $A_2=\{3,4\}$ yes? What is $A_3$? – lulu Jan 7 '18 at 11:18
• @lulu The notation is dreadful, using $n$ in two different roles as well, but I interpreted this as $A_n=\{3k,3k+1\mid k\in A_{n-1}\}$. – Angina Seng Jan 7 '18 at 11:20
• @LordSharktheUnknown Well, that definition certainly makes sense. Thanks. – lulu Jan 7 '18 at 11:21
• @lulu A_3={9,10,12,13} – user398623 Jan 7 '18 at 12:55
• You should edit your post for clarity. Why make your readers guess what you mean? – lulu Jan 7 '18 at 13:18

$A$ is the smallest set containing $1$, and closed under the operations $n\mapsto3n$ and $n\mapsto3n+1$. It follows that $A$ contains all natural numbers whose base $3$ representations contains just the digits $0$ and $1$ (and not $2$). Taking the sum of two of these numbers will give rise to no carries in base $3$. I would suggest looking at the base $3$ representation of $2017$.