Consider compass-and-straightedge construction, where you can construct new points from existing ones by examining intersections of straight lines and circles constructed with one of the following two options:
- Draw the unique infinitely long straight line passing through points \$(x, y)\$ and \$(x', y')\$
- Draw the unique circle centered on \$(x, y)\$ that passes through the distinct point \$(x', y')\$
We begin with two points, typically \$(0, 0)\$ and \$(1, 0)\$, but any two distinct points suffice. If we draw all possible lines and circles using these two points, how many total points do we end up with?
Spoiler: 6, shown below.
If we now repeat this procedure - drawing every line between two points and every circle determined by two existing points - and then add the newly constructed points to our set, we end up with 203 total points. We can then do this again, and again, and so on to form a sequence that begins $$2, 6, 203, 1723816861$$
This is A333944, added to OEIS after this Math.SE question was asked about the 4th term in the sequence. Note that, as of writing, only \$4\$ terms exist in the sequence on OEIS.
Unsurprisingly, your task is to output this sequence. This is a standard sequence challenge, meaning that you may complete one of the following options, using \$0\$ or \$1\$ indexing of your choice (if applicable):
- Take an integer \$n\$ and output the \$n\$th term in the sequence
- Take an integer \$n\$ and output the first \$n\$ terms in the sequence
- Output the sequence indefinitely, in ascending order
This is code-golf, so the shortest code in bytes in each language wins.
In the linked Math.SE question, the answer provides some Haskell code which completes this task. Unsurpsingly, it is highly ungolfed, and very slow, taking approximately \$6\$ days to find the fourth term in the sequence. I offer a 1000 rep bounty (\$2 \times 500\$ rep bounties) for the first answer which can find and verify the 5th term in the sequence. The rough upper bound given in the linked question suggests that it is no larger than \$10^{314}\$.
