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.  

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.   
