Removing points from a triangular array without losing triangles I have a combinatorics problem that I'd like to put on the OEIS—the problem is that I don't have enough terms. This code challenge is to help me compute more terms, and the winner will be the user with the submission containing the greatest number of terms.



The Problem

Suppose I give you a triangular array of light bulbs with side length \$n\$:

     o
    o o
   o o o
  o o o o
 o o o o o
o o o o o o
1 2  ...  n


I'm going to turn on three lightbulbs that form an "upright" equilateral triangle as in the following example:

     o
    o x
   o o o
  o o o o
 o x o o x
o o o o o o


Before I turn on the lights, your job is to remove as many lightbulbs as possible from the array—without losing the ability to deduce the triangle of bulbs that has been turned on. To be clear, if a lightbulb has been removed, it is not lit up when its position is turned on.

For example, if you removed the following bulbs (marked by .) you would only see the following two lights turn on (marked by x), which is enough uniquely deduce the third (unlit) position:

     .              .
    . o            . x
   . . o          . . o
  o o o .   =&gt;   o o o .
 o o o o .      o x o o . &lt;- the third unlit position
o . . . o o    o . . . o o


Let a(n) be the maximum number of bulbs that can be removed without introducing any ambiguities.



Example

With a naive algorithm, I have checked values up to a triangle with side length 7, as seen below:

                                                                      .
                                                      .              . o
                                        .            . o            o . o
                           .           . .          . . o          . o o .
              .           . .         . o o        o o o .        o o . o .
 .           . .         . o o       o o . o      o o o o .      o . o . o o
. .         . o o       . o o o     o . . o o    o . . . o o    o . o . o o o

a(2) = 3    a(3) = 4    a(4) = 5    a(5) = 7     a(6) = 9       a(7) = 11




Scoring

The submission that computes the sequence [a(2), a(3), ..., a(n)] for the largest n wins. If two submissions have identical sequences, then the one that was posted earlier wins.

Although not necessary for the submission, it would be instructive to me if you post a construction of the resulting triangluar arrays, as in the example above.
Python 3, n=8



import itertools
from ortools.sat.python import cp_model


def solve(n):
    model = cp_model.CpModel()
    solver = cp_model.CpSolver()
    cells = {
        (y, x): model.NewBoolVar(str((y, x)))
        for y in range(n) for x in range(y + 1)}
    triangles = [
            {cells[v] for v in ((y1, x1), (y2, x1), (y2, x1 + y2 - y1))}
            for (y1, x1) in cells.keys() for y2 in range(y1 + 1, n)]
    for t1, t2 in itertools.combinations(triangles, 2):
        model.AddBoolOr(t1.symmetric_difference(t2))
    model.Minimize(sum(cells.values()))
    solver.Solve(model)
    return len(cells) - round(solver.ObjectiveValue())


for n in itertools.count(2):
    print('a(%d) = %d' % (n, solve(n)))


Uses Google OR-Tools' CP-SAT solver.

After running for ~30 seconds, it outputs the following:

a(2) = 3
a(3) = 4
a(4) = 5
a(5) = 7
a(6) = 9
a(7) = 11
a(8) = 13


I didn't event try to wait for n=9 as it would probably take hours (the number of constraints grows like \$n^6\$). After less than 30 minutes of computation I found out that a(9)=15. I'm leaving my score as n=8 because at the moment the time constraints are unclear, but half an hour is probably too long.

How it works

Take two distinct equilateral triangles \$T_1\$ and \$T_2\$. To avoid ambiguity, there should be at least one bulb on a vertex belonging to exactly one of \$T_1\$ and \$T_2\$.

Thus the question may be rephrased as a SAT problem, with one constraint for every pair of triangles.

PS:
I would very much like to include an example for n=8, but I'm having issues with the SAT solver which apparently wants to keep the solutions all for itself.