Number of ordered pairs $(x,y)$ with $x,y \in \{ 1, \dots, N\}$ such that sum of numbers in pairs is divisible by $k$? Given $N$ and $k$. Find the number of ordered pairs $(x,y)$, with $x,y \in \{ 1, \dots,  N\}$
such that sum $x+y$ is divisible by $k$.
and x less than y.
example
$N=10, k=4$
answer = $10$
Pairs-
$(1,3), (1,7), (2,6), (2,10), (3,5), (3,9), (4,8), (5,7), (6,10), (7,9)$

Hint: Consider the number of values that are equal to $r \pmod{k}$ and $k-r \pmod{k}$. They would differ by at most 1. 
Write out the summation, and just do it.

Perform the division algorithm, $N = Qk + R$ where $0 \leq R < k$.
How many pairs of $(x,y)$ are there such that $x \equiv 1 \pmod{k}$ and $ x \equiv k-1 \pmod{k}$?
How many pairs of $(x,y)$ are there such that $x \equiv r \pmod{k}$ and $ x \equiv k-r \pmod{k}$?
How many pairs of $(x,y)$ are there such that $x \equiv 0 \pmod{k}$ and $ x \equiv 0 \pmod{k}$?
Note that your answer will change according to the signage of $ R - \frac{k}{2}$.
