$1,2,4,3,6,5,10,7,14,8,16,9,18,11,22,12,24,13,26,15,30,17,34,19,38,20,40,21,42,23,46,25,50,...$
such that we begin from $1$ and then write $2$ then $2\times2$ then $3$ then $2\times3$ then ... but if $n$ is even and previously we have written $0.5n$ and then $n$ then ignore $n$ and continue and write $n+1$ and then $2n+2$ and so on for example we have $1,2,4,3,6,5,10$ so after $10$ we should write $7,14,...$ because previously we have written $3,6$.
Thanks in advance!
Following is a definition of your sequence without using recursion.
Let $S=(S_0,S_1,S_2,\ldots)$ be the increasing sequence of positive integers that are expressible as either $2^e$ or as $o_1\cdot 2^{o_2}$, where $e$ is an even nonnegative integer, $o_1>1$ is an odd positive integer and $o_2$ is an odd positive integer. Thus $$S=(1, 4, 6, 10, 14, 16, 18, 22, 24, 26, 30, 34, 38, 40,42,\ldots).$$ Let $\bar{S}$ be the complement of $S$ with respect to the positive integers; i.e., $$\bar{S}=(2, 3, 5, 7, 8, 9, 11, 12, 13, 15, 17, 19, 20, 21, 23, 25,\ldots).$$ Your sequence is then $T=(T_0,T_1,T_2,\ldots)$, where $$T_n:=\begin{cases}S_{n\over 2}&\text{ if $n$ is even}\\ \bar{S}_{n-1\over 2}&\text{ if $n$ is odd.} \end{cases} $$ Thus $T=(1, 2, 4, 3, 6, 5, 10, 7, 14, 8, 16, 9, 18, 11, 22, 12, 24, 13, 26, 15, 30, 17, 34, 19, 38, 20, \ldots).$
References:
Sequences $S,\bar{S},T$ are OEIS A171945, A053661, A034701 respectively. These are all discussed in "The vile, dopey, evil and odious game players".
Sage code: