TITLE: Ordering of natural numbers
QUESTION [6 upvotes]: Show that it is possible to arrange the numbers 1, 2, . . . , n
in a row so that the average of any two of these numbers
never appears between them. 
Hint: Show that it suffices
to prove this fact when n is a power of 2. Then use mathematical
induction to prove the result when n is not a power of 2.
This is a problem from Rosen's discrete mathematics book.
I tried to think of it this way:

Take any n,find its nearest power of 2,(say m)less than or equal to n,find the arrangement for 1,2,...m,then the rest of numbers m+1,....,n just fill in the gaps within the sequence 1,...,m in a certain way.

e.g.,Take n=12,nearest power of two less than or equal to n,is,8.So arrange 1,2,...,8 which gives 1,5,3,7,2,6,4,8.Now the numbers 9,10,11,12 just fills in the arranged sequence in a particular way.Its the last part I am struggling with. How exactly does the rest of the numbers fit in?
I may be wrong with the above approach,so please share your solution,in that case.

REPLY [2 votes]: Better for your example of $n=12$ to go to the next highest power of $2$, i.e. $16$, for the pattern from your induction $$1,9,5,13,3,11,7,15,2,10,6,14,4,12,8, 16$$ and then delete all values greater than $12$ to give $$1,9,5,3,11,7,2,10,6,4,12,8.$$ The same approach will work in general.