The pyramid begins with the row 1 1
. We'll call this row 1. For each subsequent row, start with the previous row and insert the current row number between every adjacent pair of numbers that sums to the current row number.
$$
1\quad1\\
1\quad\color{red}{2}\quad1\\
1\quad\color{red}{3}\quad2\quad\color{red}{3}\quad1\\
1\quad\color{red}{4}\quad3\quad2\quad3\quad\color{red}{4}\quad1\\
1\quad\color{red}{5}\quad4\quad3\quad\color{red}{5}\quad2\quad\color{red}{5}\quad3\quad4\quad\color{red}{5}\quad1\\
1\quad\color{red}{6}\quad5\quad4\quad3\quad5\quad2\quad5\quad3\quad4\quad5\quad\color{red}{6}\quad1\\
\cdots
$$
This pyramid is an example of a false pattern. It seems to encode the prime numbers in the lengths of its rows, but the pattern breaks down later on. You may wish to learn more about this sequence from a recent Numberphile video which is the inspiration for this question.
Task
Output the sequence. You may do so in any of the following ways:
Method | Example input | Example output |
---|---|---|
The infinite sequence as rows. We must be able to tell the rows apart somehow. | - | 1 1 1 2 1 1 3 2 3 1 1 4 3 2 3 4 1 ... |
The infinite sequence as numbers, top to bottom, left to right. | - | 1 1 1 2 1 1 3... |
The first \$n\$ rows of the pyramid, 1-indexed. We must be able to tell the rows apart somehow. | 3 | 1 1 1 2 1 1 3 2 3 1 |
The first \$n\$ rows of the pyramid, 0-indexed. We must be able to tell the rows apart somehow. | 3 | 1 1 1 2 1 1 3 2 3 1 1 4 3 2 3 4 1 |
The first \$n\$ numbers in the pyramid, 1-indexed. | 4 | 1 1 1 2 |
The first \$n\$ numbers in the pyramid, 0-indexed. | 4 | 1 1 1 2 1 |
The \$n\$th row in the pyramid, 1-indexed. | 2 | 1 2 1 |
The \$n\$th row in the pyramid, 0-indexed. | 2 | 1 3 2 3 1 |
The \$n\$th number in the pyramid, 1-indexed. | 7 | 3 |
The \$n\$th number in the pyramid, 0-indexed. | 7 | 2 |
Rules
- Please specify which of the above methods your answer uses.
- Output format is highly flexible. It may take the form of your language's collection type, for instance.
- Sequence rules apply, so infinite output may be in the form of a lazy list or generator, etc.
- This is code-golf, so the answer with the fewest bytes (in each language) wins.
- Standard loopholes are forbidden.