A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.
2

I am not giving a new solution. But I'd like to propose a nicer expression of the solution given for the general case $n=2^k$. In fact my solution is the same as noedne's. And the explanation why it works is the same as OHO's.


Only top voted, non community-wiki answers of a minimum length are eligible