# Upper and lower bounds

Upper and lower bounds for $c_n$ for small values of n.

$c_n$ is the size of the largest subset of $[3]^n$ that does not contain a combinatorial line. A spreadsheet for all the latest bounds on $c_n$ can be found here. In this page we record the proofs justifying these bounds.

 n 0 1 2 3 4 5 6 7 $c_n$ 1 2 6 18 52 150 450 [1302,1350]

## Basic constructions

For all $n \geq 1$, a basic example of a mostly line-free set is

$D_n := \{ (x_1,\ldots,x_n) \in [3]^n: \sum_{i=1}^n x_i = 0 \ \operatorname{mod}\ 3 \}$. (1)

This has cardinality $|D_n| = 2 \times 3^{n-1}$. The only lines in $D_n$ are those with

1. A number of wildcards equal to a multiple of three;
2. The number of 1s equal to the number of 2s modulo 3.

One way to construct line-free sets is to start with $D_n$ and remove some additional points. We also have the variants $D_{n,0}=D_n, D_{n,1}, D_{n,2}$ defined as

$D_{n,j} := \{ (x_1,\ldots,x_n) \in [3]^n: \sum_{i=1}^n x_i = j \ \operatorname{mod}\ 3 \}$. (1')

When n is not a multiple of 3, then $D_{n,0}, D_{n,1}, D_{n,2}$ are all cyclic permutations of each other; but when n is a multiple of 3, then $D_{n,0}$ plays a special role (though $D_{n,1}, D_{n,2}$ are still interchangeable).

Another useful construction proceeds by using the slices $\Gamma_{a,b,c} \subset [3]^n$ for $(a,b,c)$ in the triangular grid

$\Delta_n := \{ (a,b,c) \in {\Bbb Z}_+^3: a+b+c = n \},$. (2)

where $\Gamma_{a,b,c}$ is defined as the strings in $[3]^n$ with $a$ 1s, $b$ 2s, and $c$ 3s. Note that

$|\Gamma_{a,b,c}| = \frac{n!}{a! b! c!}.$ (3)

Given any set $B \subset \Delta_n$ that avoids equilateral triangles $(a+r,b,c), (a,b+r,c), (a,b,c+r)$, the set

$\Gamma_B := \bigcup_{(a,b,c) \in B} \Gamma_{a,b,c}$ (4)

is line-free and has cardinality

$|\Gamma_B| = \sum_{(a,b,c) \in B} \frac{n!}{a! b! c!},$ (5)

and thus provides a lower bound for $c_n$:

$c_n \geq \sum_{(a,b,c) \in B} \frac{n!}{a! b! c!}.$ (6)

All lower bounds on $c_n$ have proceeded so far by choosing a good set of B and applying (6). Note that $D_n$ is the same as $\Gamma_{B_n}$, where $B_n$ consists of those triples $(a,b,c) \in \Delta_n$ in which $a \neq b\ \operatorname{mod}\ 3$.

Note that if one takes a line-free set and permutes the alphabet $\{1,2,3\}$ in any fashion (e.g. replacing all 1s by 2s and vice versa), one also gets a line-free set. This potentially gives six examples from any given starting example of a line-free set, though in practice there is enough symmetry that the total number of examples produced this way is less than six. (These six examples also correspond to the six symmetries of the triangular grid $\Delta_n$ formed by rotation and reflection.)

Another symmetry comes from permuting the $n$ indices in the strings of $[3]^n$ (e.g. replacing every string by its reversal). But the sets $\Gamma_B$ are automatically invariant under such permutations and thus do not produce new line-free sets via this symmetry.

## The basic upper bound

Because $[3]^{n+1}$ can be expressed as the union of three copies of $[3]^n$, we have the basic upper bound

$c_{n+1} \leq 3 c_n.$ (7)

Note that equality only occurs if one can find an $n+1$-dimensional line-free set such that every n-dimensional slice has the maximum possible cardinality of $c_n$.

## n=0

$c_0=1$:

This is clear.

## n=1

$c_1=2$:

The three sets $D_1 = \{1,2\}$, $D_{1,1} = \{2,3\}$, and $D_{1,2} = \{1,3\}$ are the only two-element sets which are line-free in $[3]^1$, and there are no three-element sets.

## n=2

$c_2=6$:

There are four six-element sets in $[3]^2$ which are line-free, which we denote $x = D_{2,2}$, $y=D_{2,1}$, $z=D_2$, and $w$ and are displayed graphically as follows.

    13 .. 33       .. 23 33       13 23 ..       13 23 ..
x = 12 22 ..   y = 12 .. 32   z = .. 22 32   w = 12 .. 32
.. 21 31       11 21 ..       11 .. 31       .. 21 31


Combining this with the basic upper bound (7) we see that $c_2=6$.

## n=3

$c_3=18$:

We describe a subset $A$ of $[3]^3$ as a string $abc$, where $a, b, c \subset [3]^2$ correspond to strings of the form $1**$, $2**$, $3**$ in $[3]^3$ respectively. Thus for instance $D_3 = xyz$, and so from (7) we have $c_3=18$.

Lemma 1.

• The only 18-element line-free subset of $[3]^3$ is $D_3 = xyz$.
• The only 17-element line-free subsets of $[3]^3$ are formed by removing a point from $D_3=xyz$, or by removing either 111, 222, or 333 from $D_{3,2} = yzx$ or $D_{3,3}=zxy$.

Proof. We prove the second claim. As $17=6+6+5$, and $c_2=6$, at least two of the slices of a 17-element line-free set must be from x, y, z, w, with the third slice having 5 points. If two of the slices are identical, the last slice can have only 3 points, a contradiction. If one of the slices is a w, then the 5-point slice will contain a diagonal, contradiction. By symmetry we may now assume that two of the slices are x and y, which force the last slice to be z with one point removed. Now one sees that the slices must be in the order xyz, yzx, or zxy, because any other combination has too many lines that need to be removed. The sets yzx, zxy contain the diagonal {111,222,333} and so one additional point needs to be removed.

The first claim follows by a similar argument to the second. $\Box$

## n=4

$c_4=52$:

Indeed, divide a line-free set in $[3]^4$ into three blocks $1***, 2***, 3***$ of $[3]^3$. If two of them are of size 18, then they must both be xyz, and the third block can have at most 6 elements, leading to an inferior bound of 42. So the best one can do is $18+17+17=52$ which can be attained by deleting the diagonal {1111,2222,3333} from $D_{4,1} = xyz\ yzx\ xzy$, $D_4 = yzx\ zxy\ xyz$, or $D_{4,2} = zxy\ xyz\ yxz$. In fact,

Lemma 2.

• The only 52-element line-free sets in $[3]^4$ are formed by removing the diagonal {1111,2222,3333} from $D_{4,j}$ for some j=0,1,2.
• The only 51-element line-free sets in $[3]^4$ are formed by removing the diagonal and one further point from $D_{4,j}$ for some j=0,1,2.

Proof It suffices to prove the second claim. Suppose first that we can slice this set into three slices of 17 points. Each of the slices is then formed by removing one point from xyz, yxz, and zxy. Arguing as before we obtain the claim. If one of the xyz, yzx, zyx patterns are used twice, then the third block can have at most 8 points, a contradiction, so each pattern must be used exactly once. A pattern such as xyz zxy yzx (with three points removed) cannot occur since the columns xzy, yxz, zyx of this pattern can contain at most 16 points each. So we must remove three points from $D_{4,1} = xyz\ yxz\ zyx$ or a cyclic permutation thereof. Let's say we are removing three points from $D_{4,1}$. If 3333 is not removed, then we must remove one from each of the sets {1113,2223}, {1131,2232}, {1311,2322}, {3111,3222}, causing four points to be removed in all, a contradiction; thus 3333 must be removed, and similarly 2222, and the claim follows.

If there is no such slicing available, then every slicing of the 51-point set must slice into an 18-point set, an 17-point set, and a 16-point set. By symmetry we may assume the 18-point slice is the first one, and the 17 point set is the next one:

xyz ??? ???

Looking at the vertical slices, we see that the first column must also be an xyz:

xyz y?? z??

this forces the second slice, which has 17 points, to be yzx with one point removed; in fact, the point removed must be either 2222 or 2333. This forces the third slice to be contained in zxy. Now we are back in the situation of $D_{4,1}$ with three points removed, and the claim follows from the previous argument. $\Box$

It would be useful to have a classification of the 50-point line-free sets.

## n=5

$c_5=150$:

Lemma 3. Any line-free subset of $D_{5,j}$ can have at most 150 points.

Proof. By rotation we may work with $D_5$. This set has 162 points. By looking at the triplets {10000, 11110, 12220} and cyclic permutations we must lose 5 points; similarly from the triplets {20000,22220, 21110} and cyclic permutations. Finally from {11000,11111,11222} and {22000,22222,22111} we lose two more points. $\Box$

Equality can be attained by removing $\Gamma_{0,4,1}, \Gamma_{0,5,0}, \Gamma_{4,0,1}, \Gamma_{5,0,0}$ from $D_5$. Thus $c_5 \geq 150$.

Another pattern of 150 points is this: Take the 450 points in ${}[3]^6$ which are (1,2,3), (0,2,4) and permutations, then select the 150 whose final coordinate is 1. That gives this many points in each cube:

17 18 17

17 17 18

12 17 17

Lemma 4. A line-free subset of $[3]^5$ with over 150 points cannot have two parallel $[3]^4$ slices, each of which contain at least 51 points.

Proof. Suppose not. By symmetry, we may assume that the 1**** and 2**** slices have at least 51 points, and that the whole set has at least 151 points, which force the third slice to have at least $151-2c_4 = 47$ points.

By Lemma 2, the 1**** slice takes the form $\{1\} \times D_{4,j}$ for some $j=0,1,2$ with the diagonal {11111,12222,13333} and possibly one more point removed, and similarly the 2**** slice takes the form $\{2\} \times D_{4,k}$ for some $k=0,1,2$ with the diagonal {21111,22222,23333} and possibly one more point removed.

Suppose first that j=k. Then the 1-slice and 2-slice have at least 50 points in common, leaving at most 31 points for the 3-slice, a contradiction. Next, suppose that jk=01. Then observe that the *i*** slice cannot look like any of the configurations in Lemma 2 and so must have at most 50 points for i=1,2,3, leading to 150 points in all, a contradiction. Similarly if jk=12 or 20. Thus we must have jk equal to 10, 21, or 02.

Let's suppose first that jk=10. The first slice then is equal to $\{1\} \times D_{4,1}$ with the diagonal and possibly one more point removed, while the second slice is equal to $\{2\} \times D_{4,0}$ with the diagonal and possibly one more point removed. Superimposing these slices, we thus see that the third slice is contained in $\{3\} \times D_{4,2}$ except possibly for two additional points, together with the one point 32222 of the diagonal that lies outside of $\{3\} \times D_{4,2}$.

The lines x12xx, x13xx (plus permutations of the last four digits) must each contain one point outside the set. The first two slices can only absorb two of these, and so at least 14 of the 16 points formed by permuting the last four digits of 31233, 31333 must lie outside the set. These points all lie in $\{3\} \times D_{4,2}$, and so the 3**** slice can have at most $|D_{4,2}|-14+3=43$ points, a contradiction.

The case jk=02 is similar to the case jk=10 (indeed one can obtain one from the other by swapping 1 and 2). Now we turn to the case jk=21. Arguing as before we see that the third slice is contained in $\{3\} \times D_4$ except possibly for two points, together with 33333.

If 33333 was in the set, then each of the lines xx333, xxx33 (and permutations of the last four digits) must have a point missing from the first two slices, which cannot be absorbed by the two points we are permitted to remove; thus 33333 is not in the set. For similar reasons, 33331 is not in the set, as can be seen by looking at xxx31 and permutations of the last four digits. Indeed, any string containing four threes does not lie in the set; this means that at least 8 points are missing from $\{3\} \times D_4$, leaving only at most 46 points inside that set. Furthermore, any point in the 3**** slice outside of $\{3\} \times D_4$ can only be created by removing a point from the first two slices, so the total cardinality is at most $46+52+52 = 150$, a contradiction.$\Box$

Corollary. $c_5 \leq 152$

Proof. By Lemma 4 and the bound $c_4=52$, any line-free set with over 150 points can have one slice of cardinality 52, but then the other two slices can have at most 50 points. $\Box$

An integer programming method has established the upper bound $c_5\leq 150$, with 12 extremal solutions.

This file contains the extermisers. One point per line and different extermisers separated by a line with “—”

This is the linear program, readable by Gnu’s glpsol linear programing solver, which also quickly proves that 150 is the optimum.

Each variable corresponds to a point in the cube, numbered according to their lexicografic ordering. If a variable is 1 then the point is in the set, if it is 0 then it is not in the set. There is one linear inequality for each combinatorial line, stating that at least one point must be missing from the line.

## n=6

$c_6=450$:

The upper bound follows since $c_6 \leq 3 c_5$. The lower bound can be formed by gluing together all the slices $\Gamma_{a,b,c}$ where (a,b,c) is a permutation of (0,2,4) or (1,2,3).

## n=7

$1302 \leq c_7 \leq 1350$:

The upper bound follows since $c_7 \leq 3 c_6$. The lower bound can be formed by removing 016,106,052,502,151,511,160,610 from $D_7$.

## Larger n

The following construction gives lower bounds for the number of triangle-free points, There are of the order $2.7 \sqrt{log(N)/N}3^N$ points for large N (N ~ 5000)

It applies when N is a multiple of 3.

• For N=3M-1, restrict the first digit of a 3M sequence to be 1. So this construction has exactly one-third as many points for N=3M-1 as it has for N=3M.
• For N=3M-2, restrict the first two digits of a 3M sequence to be 12. This leaves roughly one ninth of the points for N=3M-2 as for N=3M.

The current lower bounds for $c_{3m}$ are built like this, with abc being shorthand for $\Gamma_{a,b,c}$:

• $c_3$ from (012) and permutations
• $c_6$ from (123,024) and perms
• $c_9$ from (234,135,045) and perms
• $c_{12}$ from (345,246,156,02A,057) and perms (A=10)
• $c_{15}$ from (456,357,267,13B,168,04B,078) and perms (B=11)

To get the triples in each row, add 1 to the triples in the previous row; then include new triples that have a zero.

A general formula for these points is given below. I think that they are triangle-free. (For N<21, ignore any triple with a negative entry.)

• There are thirteen groups of points in the centre, that are the same for all N=3M:
• (M-7, M-3, M+10) and perms
• (M-7, M, M+7) and perms
• (M-7, M+3, M+4) and perms
• (M-6, M-4, M+10) and perms
• (M-6, M-1, M+7) and perms
• (M-6, M+2, M+4) and perms
• (M-5, M-1, M+6) and perms
• (M-5, M+2, M+3) and perms
• (M-4, M-2, M+6) and perms
• (M-4, M+1, M+3) and perms
• (M-3, M+1, M+2) and perms
• (M-2, M, M+2) and perms
• (M-1, M, M+1) and perms
• There is also a string of points, that is slightly different for odd and even N:
• For N=6K:
• (2x, 2x+2, N-4x-2) and permutations (x=0..K-4)
• (2x, 2x+5, N-4x-5) and perms (x=0..K-4)
• (2x, 3K-x-4, 3K+x+4) and perms (x=0..K-4)
• (2x, 3K-x-1, 3K+x+1) and perms (x=0..K-4)
• (2x+1, 2x+5, N-4x-6) and perms (x=0..K-5)
• (2x+1, 2x+8, N-4x-9) and perms (x=0..K-5)
• (2x+1, 3K-x-1, 3K-x) and perms (x=0..K-5)
• (2x+1, 3K-x-4, 3K-x+3) and perms (x=0..K-5)
• For N=6K+3: the thirteen points mentioned above, and:
• (2x, 2x+4, N-4x-4) and perms, x=0..K-4
• (2x, 2x+7, N-4x-7) and perms, x=0..K-4
• (2x, 3K+1-x, 3K+2-x) and perms, x=0..K-4
• (2x, 3K-2-x, 3K+5-x) and perms, x=0..K-4
• (2x+1, 2x+3, N-4x-4) and perms, x=0..K-4
• (2x+1, 2x+6, N-4x-7) and perms, x=0..K-4
• (2x+1, 3K-x, 3K-x+2) and perms, x=0..K-4
• (2x+1, 3K-x-3, 3K-x+5) and perms, x=0..K-4

An alternate construction:

First define a sequence, of all positive numbers which, in base 3, do not contain a 1. Add 1 to all multiples of 3 in this sequence. This sequence does not contain a length-3 arithmetic progression.

It starts 1,2,7,8,19,20,25,26,55, …

Second, list all the (abc) triples for which the larger two differ by a number from the sequence, excluding the case when the smaller two differ by 1, but then including the case when (a,b,c) is a permutation of N/3+(-1,0,1)

## Asymptotics

DHJ(3) is equivalent to the upper bound

$c_n \leq o(3^n)$

In the opposite direction, observe that if we take a set $S \subset [3n]$ that contains no 3-term arithmetic progressions, then the set $\bigcup_{(a,b,c) \in \Delta_n: a+2b \in S} \Gamma_{a,b,c}$ is line-free. From this and the Behrend construction it appears that we have the lower bound

$c_n \geq 3^{n-O(\sqrt{\log n})}$

though this has to be checked.

Numerics suggest that the first large n construction given above above give a lower bound of roughly $2.7 \sqrt{\log(n)/n} \times 3^n$, which would asymptotically be inferior to the Behrend bound.

The second large n construction had numerical asymptotics for \log(c_n/3^n) close to $1.2-\sqrt{\log(n)}$ between n=1000 and n=10000, consistent with the Behrend bound.

## Numerical methods

A greedy algorithm was implemented here. The results were sharp for $n \leq 3$ but were slightly inferior to the constructions above for larger n.