What we want are c=1,1008,1009,2016, and the number of f is 2017.
Let a%b denote the remainder of a divided by b, where 0≤a%b<b.
Note that (cx+k)%2017 satisfies the condition (where k=0,1,…,2016).
In the following, we'll prove there is another solution when c=1,1008,1009,2016:
When c=0, let
f0(2017n+1)=f0(2017n+c+1)=f0(2017n+2c+1)=c,
let f0(x)=0 for the others. (f0(x)+f0(y))%2017 can only be 0,c,2c%2017,
but since c=1,1008,1009,2016, we have
0,c,2c%2017∈/{1,(c+1)%2017,(2c+1)%2017},
so
f0(f0(x)+f0(y))=0, and f0(f0(x)+f0(y)+1)=c.
So f0 satisfies the condition, and f0 is different from (cx+k)%2017.
Let f0(x)=1 for the others. (f0(x)+f0(y)%2017 can only be 2,4,6, and
f0(2)=f0(3)=f0(4)=f0(5)=f0(6)=f0(7),
so f0 satisfies the condition, and f0 is different from (cx+k)%2017.
Next, we'll prove when c=1,1008,1009,2016, all solutions are (cx+k)%2017:
Assume f is a solution satisfying the condition, we'll prove f is onto first. If f is not onto, we can find a longest "good sequence" {ai}i=1r in the range of f, where "good sequence" means a sequence in the form ai=(ci+d)%2017. Since 2017 is a prime, and f is not onto, the longest good sequence we found has finite length.
Substitute (x,y) into (2) such that (f(x),f(y))=(ai,aj),i,j=1,2,…,r:
When c=1, let bi=f(a1+ai),br+1=f(a1+ar+1).
When c=1008, let bi=f(ar+1−i+ar+1−i),br+1=f(2a1+1).
When c=1009, let bi=f(ai+ai),br+1=f(2ar+1).
When c=2016, let bi=f(a1+ar+1−i),br+1=f(2a1+1).
Then we have {bi}i=1r+1 as a longer good sequence, contradiction! So f is onto, and we get f(x+1)−f(x)≡c(mod2017), ∀x. So there exists k such that f(x)=(cx+k)%2017.