An Irregular Sequence

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)?

Solution