First number $\ge n$ that is divisible by $k$? Is there a good way to compute the first value $\ge n$ that is divisible by $k$?
Right now I am computing $\left\lfloor\frac{n}{k}\right\rfloor k$ but it doesn't always work.
 A: How about $(n-(n\mod k))\mod k$? This should do the job.
A: Well, if $n \equiv 0\pmod k$, then then $n$ works, as $k$ divides $n - 0 = n$.
If $n \equiv 1 \pmod k$, that means $k$ divides $n - 1$, so $n - 1  +k$ works. 
If $n \equiv 2 \pmod k$, that means $k$ divides $n - 2$, so $n - 2 + k$ works.
Do you think you could generalize this, assuming you have the ability to find the residue of $n$, modulo $k$?
A: Start with
$u(n, k)
=k\lceil \frac{n}{k} \rceil
$
being the smallest multiple of $k$
that is $\ge n$.
We now use
$\lceil \frac{n}{k} \rceil
=\lfloor \frac{n+k-1}{k} \rfloor
$.
To see this,
write $n = ak+b$
where
$0 \le b \le k-1$.
Then
$\lceil \frac{n}{k} \rceil
=a
$
if $b=0$
and
$a+1$ if $b > 0$.
But
$\lfloor \frac{n+k-1}{k} \rfloor
=\lfloor \frac{ak+b+k-1}{k} \rfloor
=a+\lfloor \frac{b+k-1}{k} \rfloor
=a$
if $b=0$
and $a+1$
if $b > 0$
Therefore
$u(n, k)
=k \lfloor \frac{n+k-1}{k} \rfloor
$.
A: Claim $m=\left\lfloor\frac{n+k-1}{k}\right\rfloor k$ works.
Proof This is obviously a multiple of $k$. To prove that it is the smallest larger than $n$ we must show 
$$m-k < n \leq m$$
To see this, we use 
$$\frac{n+k-1}{k}-1 < \left\lfloor\frac{n+k-1}{k}\right\rfloor \leq \frac{n+k-1}{k}$$
Thus
$$\frac{n-1}{k} < \left\lfloor\frac{n+k-1}{k}\right\rfloor \leq \frac{n+k-1}{k}\\
n-1< k \left\lfloor\frac{n+k-1}{k}\right\rfloor \leq n+k-1 \\
n-1< m \leq n+k-1 \\
$$
Now, since $n,m $ are integers we get the implications
$$n-1< m \Rightarrow n \leq m$$
and
$$ m \leq n+k-1 \Rightarrow m-k \leq n-1 <n$$
Therefore 
$$m-k < n \leq m$$
as claimed.
