Define a sequence as follows:

f(0) = 0

f(1) = 1

f(n) = least integer greater than f(n-1) that does not make an arithmetic progression with any two previous members of the sequence.

This sequence starts off like this: 0, 1, 3, 4, 9, 10, 12, ...

What is f(4100)?

The sequence continues:

n | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

f(n) | 0 | 1 | 3 | 4 | 9 | 10 | 12 | 13 | 27 | 28 | 30 | 31 | 36 |

Note that when n is a power of 2, f(n) is a power of 3.
This gives us a clue!
We claim that f(n) is related to n as follows: write n in base 2, and
interpret the result in base 3 to get f(n).
For example, n = 11 = 1011_{2}, and 1011_{3} = 31 = f(11).
As a result, the sequence contains all numbers which have all digits
equal to 0 or 1 when written in base 3.

We prove this by induction. The claim is that the first n members of
the sequence consist of the first n non-negative integers consisting
entirely of digits 0 and 1 when written in base 3.
It's clearly true for n = 1.
Assume that it's true for the case n = k.
and let a_{0}, a_{1}, ..., a_{k} be the
first k non-negative integers consisting entirely of digits 0 and 1 when
written in base 3.

Suppose that the next possible number in the sequence, a_{k+1}
contains some 2 digits when written in base 3.
In this case, we have an arithmetic sequence immediately, since the numbers
with digits 0 and 1 in those positions are previous members.

If the common difference contains only 1's and 0's, then the positions where it has a 1 must match the positions where r has a 0, since otherwise s would have a 2 in that position. But that means that t will have a 2 in that position, so this case is not possible.

As a result, k must have at least one 2 when written in base 3. Let i the
lowest position where k has a 2. Then r must have a 1 in position i, since
otherwise s would have a 2 in that position. Furthermore, all lower
positions in r, s and k are 0's or 1's.
Now consider position i in t.
The value is 1 in r, 2 in k, and 0 in s.
Furthermore, the numbers formed from positions i-1 to 0 in s and k are
less than 3^{i}/2, since they contain only 0's and 1's, so there
can't be any carry over into position i when s and k are added.
Therefore, t must have the digit 2 in position i.
This contradicts the definition of t, and proves that there can't be an
arithmetic sequence (r, s, t).

So, to find f(4100), we write it in base 2 as 4096 + 4 = 2^{12}
+ 2^{2} = 1000000000100_{2},
and interpret that as 1000000000100_{3} = 3^{12} +
3^{2} = 531441 + 9 = 531450.