Rewrite ceil function of integer division

283 Views Asked by At

Say I have $\lceil \frac{a}{b} \rceil$, where both a and b are integers, is it possible to rewrite this?

My intuition tells me that I can rewrite it as $\lfloor \frac{a}{b} \rfloor + (a\mod{b})$, but wolframalpha tells me no. However, wolframalpha does not know I'm using integers for a and b.

Preferably I would rewrite it to some form completely without ceilings and floors. Is something like this possible?

1

There are 1 best solutions below

0
On

We have $\lceil \frac ab \rceil = \lfloor \frac ab \rfloor+1$ unless $b$ divides into $a$ evenly. In that case, do not add $1$.