RMM 2015 /P1: Does there exist an infinite sequence of positive integers $a_1, a_2, a_3, . . .$ Does there exist an infinite sequence of positive integers $a_1, a_2, a_3, . . .$ such that $a_m$ and $a_n$ are coprime if and only if $|m - n| = 1$?
My Progress:This is a very beautiful problem ! I think I have got a construction , but I am not able to  have/define the explicit formula for the nth term.
Here is the construction, Let $a_1=2\cdot 3$, $a_2=5\cdot 7$, $a_3=2\cdot 11$, $a_4=3\cdot 5 \cdot 13$, $a_5=2\cdot 7\cdot 17$ , $a_6=3\cdot 5 \cdot 11 \cdot 19$ , $a_7=2\cdot7\cdot13\cdot23$,  $a_8=3\cdot5\cdot11\cdot17\cdot29$ , $a_9=2\cdot7\cdot13\cdot 19 \cdot 31$ and so on .
I am trying to find some patterns, but I am not able to observe anything.
So what I am doing is, for the construction of $a_n$ term, I look at $a_{n-1}$ ,then I start from $a_1$ and then try to put a factor $p$  of $a_1$ in $a_n$ such that gcd ($a_{n-1},p$)=$1$ . Similarly for $a_2$, $a_3$, and so on. At the end I add another prime which was not used in any of the $a_i$'s. Also we have to make sure that no ${a_i} \mid a_j$ for $i<j$
Also note that I am only using primes .
Sorry, if something is not clear. Hope one can provide me some hints and guide.
Thanks in advance.

We'll do an inductive process, defining $a_{i,j}$ for integers $i \ge 1$ and $j \ge 0$.
Let $p_n$ be the $n$'th prime.
Initially, take $a_{1,1}= p_1 p_2 $, $a_{2,1} = 1$, $a_{n,1} = p_1$ if $n \ge 3$ is odd and $p_2$ if $n \ge 4$ is even.  Note that $a_{n,1}$ and $a_{n+1,1}$ are coprime, and $a_{1,1}$ and $a_{n,1}$ are not coprime for $n \ge 3$.  Suppose at stage $k$, all $a_{n,k}$ and $a_{n+1,k}$ are coprime, $a_{i,k}$ and $a_{j,k}$ are not coprime for $i \le k$ and $j \ge i+2$, and all prime factors of the $a_{n,k}$ are in the first $2k$ primes.  Let
$a_{k+1,k+1} = a_{k+1,k} p_{2k+1} p_{2k+2}$, $a_{n,k+1} = a_{n,k} p_{2k+1}$ if $n \ge k+3$ is even, $a_{n,k+1} = a_{n,k} p_{2k+2}$ if $n \ge k+3$ is odd, $a_{n,k+1} = a_{n,k}$ if $n < k$ or $n=k+1$.  Then we still have
$a_{n,k+1}$ and $a_{n+1,k+1}$ coprime, while $a_{i,k+1}$ and $a_{j,k+1}$ are not coprime for $i \le k+1$ and $j \ge i+2$, and all prime factors of the $a_{n,k+1}$ are in the first $2k+2$ primes.
Finally, take $a_n = a_{n,n}$.
