Find $2^k$ elements from the set ${0,1,\cdots,3^k-1}$ such that none of these element is the average of two other elements of $T$. The problem is:
Consider the set $S = \{0, 1, 2, \ldots, 3^k-1\}$. Prove that one can choose $T$ to be a $2^k$-element subset of $S$ such that none of the elements of $T$ can be represented as the arithmetic mean of two distinct elements of $T$.
I have represented the numbers in base $3$,then I have tried on small cases and I think all the numbers(in base $3$) with $k$ number of positive digits satisfy the problem. But I don't know how I can prove. Can someone help me out to prove it?
 A: Let $T$ be the numbers whose base-3 expansion has no 1. Then show that given any two distinct numbers in $T$ their arithmetic mean has a 1 in its base-3 expansion. 
A: For $n=1,2$ choosing $0,1,3,4$ works. 
Induction:
Our induction hypothesis will be stronger than the desired result:
We can choose $2^k$ numbers less than $\dfrac{3^k-1}2$, such that no three of them from an arithmetic sequence. 
Checking the base cases are trivial.
Now, suppose we have $2^k$ numbers less than $\dfrac{3^k-1}2$, such that no three of them from an arithmetic sequence. Let  $a_1<a_2<\cdots<a_{2^k}$ be those numbers. Then, define $a_{2^k+i}=3^k+a_i$. Clearly $a_{2^{k+1}}\le 3^k+\dfrac{3^k-1}2=\dfrac{3^{k+1}-1}2$
As $a_{2^k+i}$s are a translation of $a_i$s they won't form an arithmetic sequence between themselves. Moreover, 
$$\frac12(a_{2^k+j}+a_i)=\frac12(3^k+{a_i+a_j})\le \frac12(3^k+{\dfrac{3^k-1}2+\dfrac{3^k-1}2})\le 3^k-1$$
$$\frac12(a_{2^k+j}+a_i)=\frac12(3^k+{a_i+a_j})\ge \frac123^k\ge \frac{3^k-1}2$$
Thus, $$a_{2^k}<\frac12(a_{2^k+j}+a_i)<a_{2^k+1}$$
So, there are no arithmetic progressions, where the smallest number is from $a_1,\cdots,a_{2^k}$ and the largest term is from $a_{2^k+1},\cdots,a_{2^{k+1}}$. Thus, $a_1,\cdots,a_{2^{k+1}}$ does not contain any arithmetic progressions. The induction is over.
A: Indeed, consider the set of numbers where each digit in base 3 is 1 or 2.
Let $a,b$ be two such numbers with the same parity and suppose they agree on the last $r$ positions and differ in the $(r+1)$th position from the right.
Then $a=\ldots 1 x x \ldots x$ and $b= \ldots 2 x x \ldots x$ in base 3. Then their average has $x$ in the last $r$ positions and has a zero in the $(r+1)$th position from right. To see this, let $A,B$ be the numbers obtained by removing the last $r$ digits of $a,b$ resp. Then the base 3 rep of $(a+b)/2$ is just the base 3 rep of $(A+B)/2$ followed by $r$ of the $x$s. Since $A+B$ is divisible by 3, the conclusion follows.
