We defer the constructions to the end of the solution. Instead, we begin by characterizing all such functions f, prove a formula and key property for such functions, and then solve the problem, providing constructions.
Characterization
Suppose f satisfies the given relation. The condition can be written more strongly as
f(x1,y1)>f(x2,y2)⟺f(x1+1,y1)>f(x2+1,y2)⟺f(x1,y1+1)>f(x2,y2+1).
In particular, this means for any (k,l)∈Z2,f(x+k,y+l)−f(x,y) has the same sign for all x and y.
Call a non-zero vector (k,l)∈Z⩾0×Z⩾0 a needle if f(x+k,y)−f(x,y+l)>0 for all x and y. It is not hard to see that needles and non-needles are both closed under addition, and thus under scalar division (whenever the quotient lives in Z2).
In addition, call a positive rational number lk a grade if the vector (k,l) is a needle. (Since needles are closed under scalar multiples and quotients, this is well-defined.)
Claim. Grades are closed upwards.
Proof. Consider positive rationals l1k1<l2k2. We need to show that l2k2 is a grade. Since l1k1 is a grade, (k1,l1) is a needle. Thus, f(x+k1,y)−f(x,y+l1)>0 for all x and y. Since l1k1<l2k2, there exists a positive integer n such that l1k1<l2k2<l1k1+n. Therefore, (k2,l2) is a needle, as wanted.
Claim. A grade exists.
Proof. If no positive integer n is a grade, then f(1,0)>f(0,n) for all n, which is impossible. Similarly, there is an n such that f(0,1)>f(n,0). Thus, a grade must exist.
Claim. If x1+y1α>x2+y2α then f(x1,y1)>f(x2,y2).
Proof. If both x1≥x2 and y1≥y2 this is clear. Suppose x1≥x2 and y1<y2. Then x1+y1α>x2+y2α implies x1−x2>(y2−y1)α. Since α is a grade, (x1−x2,y2−y1) is a needle. This gives f(x1,y1)>f(x2,y2). Suppose x1<x2 and y1≥y2. Then x1+y1α>x2+y2α implies (y1−y2)α>x2−x1. Since α is a grade, (x2−x1,y1−y2) is a needle. This gives f(x1,y1)>f(x2,y2).
From this claim, we immediately get that 2500≤N≤7500; now we show that those bounds are indeed sharp.
Remember that if α is irrational then
f(a,b)=#{(x,y)∈Z⩾0×Z⩾0∣x+yα<a+bα}.
Construction for 7500
Select α≈199.999.
Claim.
1. f(n,0)=n for 0≤n≤100.
2. f(0,k)≡kmod2 for 0≤k≤100.
Proof.
1. f(n,0)=#{(x,y)∣x+yα<n}=#{(x,y)∣x+199y<n}=n.
2.
f(0,k)=#{(x,y)∣x+yα<kα}=l=0∑k−1#{(x,l)∣x+lα<kα}=l=0∑k−1#{x∣x<(k−l)α}=l=0∑k−1200(k−l)−1=200A−k
for some integer A.
From this claim, using the equality f(x,y)+f(x+1,y+1)=f(x+1,y)+f(x,y+1)+1, we can prove that mod 2 the region A looks like the following: in the rows (−,2y) the remainders modulo 2 alternate, while the rows (−,2y+1) contain only odd numbers.
!
The numbers mod 2 in the construction for 7500.
Construction for 2500
Select α≈200.001.