17. (GBR) A sequence of integers $a_{1}, a_{2}, a_{3}, \ldots$ is defined as follows: $a_{1}=1$, and for $n \geq 1, a_{n+1}$ is the smallest integer greater than $a_{n}$ such that $a_{i}+a_{j} \neq 3 a_{k}$ for any $i, j, k$ in $\{1,2, \ldots, n+1\}$, not necessarily distinct. Determine $a_{1998}$.
17. Initially, we determine that the first few values for \(a_{n}\) are \(1,3,4,7,10\), \(12,13,16,19,21,22,25\). Since these are exactly the numbers of the forms \(3k+1\) and \(9k+3\), we conjecture that this is the general pattern. In fact, it is easy to see that the equation \(x+y=3z\) has no solution in the set \(K=\{3k+1, 9k+3 \mid k \in \mathbb{N}\}\). We shall prove that the sequence \(\{a_{n}\}\) is actually this set ordered increasingly. Suppose \(a_{n}>25\) is the first member of the sequence not belonging to \(K\). We have several cases: (i) \(a_{n}=3r+2, r \in \mathbb{N}\). By the assumption, one of \(r+1, r+2, r+3\) is of the form \(3k+1\) (and smaller than \(a_{n}\)), and therefore is a member \(a_{i}\) of the sequence. Then \(3a_{i}\) equals \(a_{n}+1\), \(a_{n}+4\), or \(a_{n}+7\), which is a contradiction because \(1,4,7\) are in the sequence. (ii) \(a_{n}=9r, r \in \mathbb{N}\). Then \(a_{n}+a_{2}=3(3r+1)\), although \(3r+1\) is in the sequence, a contradiction. (iii) \(a_{n}=9r+6, r \in \mathbb{N}\). Then one of the numbers \(3r+3, 3r+6, 3r+9\) is a member \(a_{j}\) of the sequence, and thus \(3a_{j}\) is equal to \(a_{n}+3\), \(a_{n}+12\), or \(a_{n}+21\), where \(3,12,21\) are members of the sequence, again a contradiction. Once we have revealed the structure of the sequence, it is easy to compute \(a_{1998}\). We have \(1998=4 \cdot 499+2\), which implies \(a_{1998}=9 \cdot 499+a_{2}=4494\).