<s>[INST] Find a function $f$ such that $\gcd(f(x)-f(y),x-y)\mid 2$ For all integers $x,y$. Find a function $f$ such that $\gcd(f(x)-f(y),x-y)\mid 2$ For all integers $x,y$.
This was a question proposed to me by my teacher to attempt,
I tried to find a function such that $f(x)-f(y)=x-y+1 $ but there are no solutions for that because$f(y)-f(z)=y-z+1$ therefore $f(x)-f(z)=x-z+2$ which is a contradiction
Excuse any bad english please, it is not my first language
 [/INST] I claim that no such function exists.
Suppose that $f$ is such a function, and consider the values
$$
\begin{align*}
  a & = f(4) - f(1) & b & = f(7) - f(4) & c & = f(10) - f(7).
\end{align*}
$$
If $3 \mid a$ then we would have that $\gcd(f(4) - f(1), 4 - 1) \geq 3$, which would be a contradiction. Thus $3 \nmid a$. Similarly, $3 \nmid b$ and $3 \nmid c$.
So $a$, $b$, and $c$ all leave a remainder of $1$ or $2$ when divided by $3$. Suppose that two consecutive values, say $a$ and $b$ have different remainders when divided by $3$. Then we have that $3 \mid a + b$, and so $\gcd(f(7) - f(1), 7 - 1) = \gcd(a + b, 6) \geq 3$. Thus we must have that $3 \nmid a + b$, and so $a$ and $b$ have the same remainder when divided by $3$. Similarly, $b$ and $c$ also have the same remainder when divided by $3$.
But then we have that $a$, $b$, and $c$ all have the same remainder when divided by $3$, and so $3 \mid a + b + c$. We thus have that $\gcd(f(10) - f(1), 10 - 1) = \gcd(a + b + c, 9) \geq 3$, a contradiction.

edit: We can use a similar idea to show that for any fixed positive integer $n$, there are no functions $f : \mathbb{Z} \to \mathbb{Z}$ such that
$$
  \gcd(f(x) - f(y), x - y) < n
$$
for all integers $x$ and $y$.
Consider the values $f(0), f(n), f(2n), \dots, f(n^2)$. There are $n + 1$ of them, and so by the pigeonhole principle, two of them have the same remainder when divided by $n$. Let these be $f(kn)$ and $f(mn)$ so that $n \mid f(kn) - f(mn)$. We then have that
$$
  \gcd(f(kn) - f(mn), kn - mn) \geq n,
$$
a contradiction.
</s>