<s>[INST] 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.
 [/INST] 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
$.
</s>