How can I generate first n elements of the sequence 3^i * 5^j * 7^k?
Here I assume $0\in \mathbb N$. If you disagree start with $105$.

Let $S$ be the sequence of numbers of the form $3^i5^j7^k$. Our task is to generate these numbers in order.
Apart from $1$ each number added is of the form $3\cdot x$, $5\cdot y$ or $7\cdot z$ where $x,y,z$ are previous numbers in the sequence. We can generate $S$ by shifting $x,y,z$ along the sequence.

So, first put $1$ into $S$, and set $x,y,z$ equal to $1$.

Now repeat: Take the minimum value $m$ of $3\cdot x$, $5\cdot y$ and $7\cdot z$, and add $m$ to the sequence $S$. The $x,y,z$ for which the minimum was taken are shifted to the next element of $S$. This might be more than one, or even all three.

$\newcommand{\ul}[1]{\underline{#1}}$
$\begin{array}{r|rr|rr|rr} S &amp; x &amp; {}*3 &amp; y &amp; {}*5 &amp; z &amp; {}*7 &amp; \\\hline
1 &amp; 1 &amp; \ul{3} &amp; 1 &amp; 5 &amp; 1 &amp; 7 \\
3 &amp; 3 &amp; 9 &amp;   &amp; \ul{5} &amp;   &amp; 7 \\
5 &amp;   &amp; 9 &amp; 3 &amp; 15 &amp;   &amp; \ul{7} \\
7 &amp;   &amp; \ul{9} &amp;   &amp; 15 &amp; 3 &amp; 21 \\
9 &amp; 5 &amp; \ul{15} &amp;   &amp; \ul{15} &amp;  &amp; 21 \\
15 &amp; 7 &amp; \ul{21} &amp; 5 &amp; 25 &amp;   &amp; \ul{21} \\
21 &amp; 9 &amp; 27 &amp;   &amp; \ul{25} &amp; 5 &amp; 35 \\
25 &amp;   &amp; \ul{27} &amp; 7 &amp; 35 &amp;   &amp; 35 \\
27 &amp; 15 &amp; 45 &amp;   &amp; \ul{35} &amp;   &amp; \ul{35} \\
35 &amp;    &amp; \ul{45} &amp; 9 &amp; \ul{45} &amp; 7 &amp; 49 \\
45 &amp; 21 &amp; 63 &amp; 15 &amp; 75 &amp;   &amp; 49 
\end{array}$

Works in linear time, as we need to take the minimum of three numbers in each step.