7.4. Find the minimal cardinality of a finite set $A$, for which there is a function $f: \mathbf{N} \rightarrow A$ such that if the number $|i-j|$ is prime, then $f(i) \neq f(j)$.

## 8th BALKANIAN MATHEMATICAL OLYMPIAD

CONSTANTGA, Romania, 1991.
7.4. For integers $1,3,6,8$, differences of any two are primes. According to the condition in our problem, $f(1), f(3), f(6), f(8)$ must all be mutualy different, so that $A$ has at least four elements.

Let us define $A=\{1,2,3,4\}$ and $f(n) \equiv n(\bmod 4)$. From $f(i)=f(j)$ we conclude $i \equiv j(\bmod 4)$, i.e. four divides $|i-j|$, so that $|i-j|$ not prime. Therefore the minimal cardinality of $A$ is 4 .