How to find a general formula for union of two arithmetic progressions Suppose we have two arithmetic progressions, e.g:
$${a_{n}=a_{1}+(n-1)d}$$
$${b_{n}=b_{1}+(n-1)e}$$
How do we find a non-recursive formula for nth member of progression $c_{n}$ such, that it is a strictly growing union of $a_{n}$ and $b_{n}$ with no duplicates? For example, for the following arithmetic progressions:
$${a_{n}=6n}$$
$${b_{n}=8n}$$
$${c_{n}=?}$$
Then $c_{n}$ should yield the following sequence: $0, 6, 8, 12, 16, 18, 24, 30, ...$
 A: So we are given the two sequences
$$ \bbox[lightyellow] {  
a_{\,n}  = a_{\,1}  + \left( {n - 1} \right)d\quad b_{\,n}  = b_{\,1}  + \left( {n - 1} \right)e\quad \left| {\;1 \le n} \right.
} $$
When drawn on the cartesian plane, taking $n$ to be continuous, they will correspond to two lines, which
 will cross each other at $n = \left( {b_{\,0}  - a_{\,0} } \right)/\left( {d - e} \right)$, which may be either negative or non-negative.
Let us assume for the moment that it be negative, and let us rearrange the sequences to start at $n=0$, which much simplifies the following arguments.
Without loss of generality, we can assume $a_{n} \le b_{n}$.  
So we are considering:
$$ \bbox[lightyellow] {  
\left\{ \matrix{
  a_{\,n}  = a_{\,0}  + d\,n \hfill \cr 
  b_{\,n}  = b_{\,0}  + e\,n \hfill \cr}  \right.\quad \left| \matrix{
  \;0 \le n \hfill \cr 
  \;0 \le a_{\,0}  \le b_{\,0}  \hfill \cr 
  \;0 \le d \le e \hfill \cr}  \right.
} \tag{1} $$
also assuming that all the parameters be integers, because if they were rationals we can always multiply 
by their LCM and reconduce ourselves to the above.
The two sequences will produce the same result $a_{n}=b_{m}$ 
$$ \bbox[lightyellow] {  
a_{\,0}  + d\,n = b_{\,0}  + e\,m\quad  \Rightarrow \quad d\,x + e\,y = b_{\,0}  - a_{\,0} 
} \tag{2} $$
when and if the indicated corresponding Bezout's Identity
has solutions, which depends on the $\gcd$'s of the parameters.


*

*2.a) If there is a solution ($\gcd{(e,d)}$ divides $ b_{\,0}  - a_{\,0}$), call it $\left( {n^ *  ,m^ *  } \right) = \left( {x^ *  , - y^ *  } \right)$,
then they will repeat infinitely as $\left( {n^ *  ,m^ *  } \right) + k\left( {e,d} \right)$;  

*2.b) if there is not ($\gcd{(e,d)}$ does not divide $ b_{\,0}  - a_{\,0}$), then the two sequences are never including the same value.


That premised, the problem requires to merge the two sequences into a single increasing one, $c$.
We have assumed $a$ to be lower than $b$, then $c$ will start as
$$ \bbox[lightyellow] {  
c = \left\{ {a_{\,0} ,a_{\,0}  + d1, \cdots ,a_{\,0}  + d\,q_{\,0} } \right\} = \left\{ {a_{\,0} ,a_{\,1} , \cdots ,a_{\,q_{\,0} } } \right\}
} $$
and we make a stop at $a_{\,0}  + d\,q_{\,0} $ that is at the maximum index of the $a$ sequence for which
$$ \bbox[lightyellow] {  
a_{\,0}  + d\,q_{\,0}  < b_{\,0} \quad  \Rightarrow \quad q_{\,0}  = \left\lceil {{{b_{\,0}  - a_{\,0} } \over d}} \right\rceil  - 1 = \left\lfloor {{{b_{\,0}  - a_{\,0}  - 1} \over d}} \right\rfloor 
} $$
Thereafter we insert $b_0$ (the ceiling assures that it is not a duplicate of the precedent $a$ sequence) and continue
$$ \bbox[lightyellow] {  
\displaylines{
  c = \left\{ {a_{\,0} ,} \right.a_{\,1} ,\;\; \cdots \;\;,a_{\,q_{\,0} } , \cr 
  \quad b_{\,0} ,a_{\,q_{\,0}  + 1} , \cdots ,a_{\,q_{\,1} } , \cr 
  \quad b_{\,1} ,\; \cdots  \cr 
  \quad \quad  \vdots  \cr 
  \left. {\quad b_{\,d - 1} ,a_{\,q_{\,d - 1}  + 1} , \cdots ,a_{\,q_{\,d} } } \right\} \cr} 
} \tag{3} $$
where
$$ \bbox[lightyellow] {  
q_{\,k}  = \left\lceil {{{b_{\,0}  - a_{\,0}  + k\,e} \over d}} \right\rceil  - 1 = \left\lfloor {{{b_{\,0}  - a_{\,0}  - 1 + k\,e} \over d}} \right\rfloor 
} $$
However it may happen that $a_{\,q_{\,k}  + 1}=b_{k}$, when
$$ \bbox[lightyellow] {  
\eqalign{
  & b_{\,k}  = b_{\,0}  + ke = a_{\,q_{\,k}  + 1}  = a_{\,0}  + d\left\lceil {{{b_{\,0}  - a_{\,0}  + k\,e} \over d}} \right\rceil \quad  \Rightarrow   \cr 
  &  \Rightarrow \quad {{b_{\,0}  - a_{\,0}  + ke} \over d} = \left\lceil {{{b_{\,0}  - a_{\,0}  + k\,e} \over d}} \right\rceil \quad  \Rightarrow   \cr 
  &  \Rightarrow \quad b_{\,0}  - a_{\,0}  + k\,e \equiv 0\quad \left( {\bmod d} \right)\quad  \Rightarrow   \cr 
  &  \Rightarrow \quad \left( {\,q_{\,k}  + 1,k} \right) \in \left\{ {{\rm solutions}\,{\rm of}(2)} \right\} \cr} 
} \tag{4} $$
and we shall cancel either $b_k$ or $a_{\,q_{\,k}  + 1}$.
We have broken the sequence in (3) just before $b_d$, since:
$$ \bbox[lightyellow] {  
\left\{ \matrix{
  q_{\,d}  = \left\lfloor {{{b_{\,0}  - a_{\,0}  - 1 + d\,e} \over d}} \right\rfloor  = q_{\,0}  + e \hfill \cr 
  b_{\,d}  = b_{\,0 + d}  \hfill \cr 
  a_{\,q_{\,d}  + 1}  = a_{\,0}  + d\left\lfloor {{{b_{\,0}  - a_{\,0}  - 1 + d\,e} \over d}} \right\rfloor  = a_{\,q_{\,0}  + 1 + e}  \hfill \cr}  \right.
} \tag{5} $$
and thus in the partial sequence shown in  (3), the subsequence starting with $b_0$ repeats
adding $d$ to the $b$ indices and $e$ to the $a$ indices, and that repeats indefinitely.
Note that in the starting partial $c$, there can be only one (if any) double entry, and it shall be in the second part. 
The cancelled double entry (if there was) remains cancelled in the repetition.
So we defined an algorithm to construct the sequence $c$.
It is clear that the algorithm is valid also if we choose a starting $n=n_0$ different from 0, either positive and negative,
so that the initial assumption concerning the crossing point of the two lines is inessential.
Because of the nature of the expression for $q_k$, it is in general not possible (it has not yet been found)
to capture it into a formula.
A: What you need is simple index conversion:
$c_{2n}=a_{[\frac{2n}{2}]}=a_n$ and $c_{2n+1}=b_{[\frac{2n+1}{2}]}=b_n$.
So $c_{n}=\chi_0(n)a_{[\frac{n}{2}]}+\chi_1(n)b_{[\frac{n}{2}]}$, where 
$\chi_0(n)=0$ for odd $n$ and $1$ for even $n$  
$\chi_1(n)=1$ for odd $n$ and $0$ for even $n$.
$\chi_0(n)=\frac{1+(-1)^n}{2}$
$\chi_1(n)=\frac{1-(-1)^n}{2}$ 
So finally:
$$c_{n}=\frac{1+(-1)^n}{2}a_{[\frac{n}{2}]}+\frac{1-(-1)^n}{2}b_{[\frac{n}{2}]}$$ or in expanded form
$$c_{n}=\frac{1+(-1)^n}{2}(a_{1}+({[\frac{n}{2}]}-1)d)+\frac{1-(-1)^n}{2}({b_{1}+([\frac{n}{2}]-1)e)}$$
A: This is a hint in that it shows how this can be done for a particular case. 
Assume $a_n=2n,b_n=3n$. The sequence formed by these has a "cycle" length of 6, for example: $0,s,2,3,4,s$ and $6,s,8,9,10,s$, where $s$ represent natural numbers that are skipped. There are 4 numbers in each "cycle" that are in the combined sequence. So, if $n$ indexes the sequence, a cycle starts with the number $6\cdot\lfloor\frac{n}4\rfloor$. 
Within a cycle, the numbers that are $+0,+2,+3,+4$ from the start of the cycle are in the combined sequence. This can be formulated as follows. Let $r=n \mod 4$, then the formulation is $(r+1)\mathrm{sgn}(r)$, where $\mathrm{sgn}$ is the signum (aka sign) function.
Putting it together $c_n=6\cdot\lfloor\frac{n}4\rfloor + ((n\mod 4)+1)\cdot\mathrm{sgn}(n\mod 4)$.
In the general case, formulating the numbers within a cycle to include in the combined sequence is the tricky part (whereas formulating the number that starts a cycle is relatively easy).
As a trickier example, suppose there is a cycle of length 15, and each cycle contributes 7 numbers to the combined sequence, those being the ones that are $+0,+3,+5,+6,+9,+10,+12$ from beginning of cycle. So we need to map this set $\{0,1,2,3,4,5,6\}$ to $\{0,3,5,6,9,10,12\}$. Let $r=n\mod 7$. Observe that $2r$ maps 4 of the 7 elements $\{0,3,5,6\}$. And $2r$ is one less than desired in the other three cases $\{1,2,4\}$. The formulation: $2r+\mathrm{sgn}(r)\cdot\mathrm{sgn}(|r-3|)\cdot\mathrm{sgn}(|r-5|)\cdot\mathrm{sgn}(|r-6|)$ provides that necessary correction.
This approach may lead you to say something to the effect that you want a simpler formulation. If so, that kind of condition needs to be in the OP.
