Maximal subset $\{1,\dots,256\}$ with no pairs $x = 2y$ Let $A=\{1,\dots,256\}$. Find subset $A'\subset A$ with maximal elements s. t. there are no pairs $x=2y$.
My attempt is kind "including excluding formula": $256-128+64-\dots$
First take only odd numbers, the include half of even numbers (s. t. $4k$,  $k\in\mathbb N$) and so on.  
 A: Divide the numbers into groups as follows. The first group contains $1,2,4,8, \dots,256$. The next group contains the numbers $3,6,12,24, 48,96,192$. The third consists of $5,10,20,40,80,160$. And so on. 
The first group has an odd number of numbers, that is $9$. The maximum number of these we can take is $5$, starting at $1$. The second group has $7$ numbers, of which we can take a maximum of $4$, starting at $1$.  We can grab $3$ from the third group, starting at either $5$ or $10$. Let us choose to start at $5$. 
The computation is not too bad, and it is clear that it will yield a set of maximal size. 
But note the following: the procedure described above, if in the even case we start with the "base number" of the group, produces exactly what your suggestion produces. So your much easier way of counting does give us the maximum value of the size. 
Remark: Note that your method does not pick out all  collections of maximum size, since in the groups $\{2^k (2b+1)\}$ that have an even number of elements, we have two choices of biggest subcollection. But it does identify the size of the largest possible collections.   
A: Some suggestions:


*

*These sets are called double-free sets, some more info can be found at MathWorld.

*It is not a coincidence that the range of your starting set is $\{1,\ldots,2^8\}$. 

*Let $a_n$ be the maximum size of such a set for range $\{1,\ldots,n\}$, then

*

*you can safely take all the odds,

*from the evens you cannot take these which are twice times some odd number,

*from the rest, i.e. $4k$ for some $k$, you want to take best pick, which is the same problem as $a_{\lfloor n/4 \rfloor}$.


*In other words,$$a_{n} = \left\lceil n/2\right\rceil + a_\left\lfloor n/4\right\rfloor,\quad \text{ that is, } \quad a_{4k} = 2k + a_k.$$

*With some manipulation, you can simplify it to $a_n = n - a_{\lfloor n/2 \rfloor}$, e.g. define $b_{n} = a_{n}-n+a_{\lfloor n/2 \rfloor}$ and by induction
\begin{align}
b_{1} &= 0 \\
b_{4k} &= a_{4k} - 4k + a_{2k} \\
       &= 2k+a_k - 4k + a_{2k} \\
       &= a_{2k}-2k+a_k \\
       &= b_{2k} = 0\\
b_{4k+1} &= 2k+1 + a_k - (4k+1) + a_{2k} = b_{2k} = 0 \\
b_{4k+2} &= 2k+1 + a_k - (4k+2) + a_{2k+1} = b_{2k+1} = 0\\
b_{4k+3} &= 2k+2 + a_k - (4k+3) + a_{2k+1} = b_{2k+1} = 0
\end{align}


I hope this helps $\ddot\smile$
