# Simplifying an equation over the domain of natural numbers

How can an equation like this be simplified in Mathematica where q,a,b,k are all natural numbers?

q = ((a*(b - 1))/ k) + (k - (Mod[(a*(b - 1)), k]))*(1/k)

Try with FullSimplify:

q = ((a*(b - 1))/ k) + (k - (Mod[(a*(b - 1)), k]))*(1/k);

FullSimplify[q]

(*1 + Floor[(a (-1 + b))/k]*)

Edit: thanks to the comments by @kirma and @Syed, here are the assumptions:

FullSimplify[q, (a | b | k) \[Element] PositiveIntegers]

(*1 + Floor[(a (-1 + b))/k]*)
• This is simplification doesn't make domain assumptions on variables. It does produce the same result, but to exactly make the assumption that $a$, $b$ and $k$ are natural numbers (that is, non-zero integers) is to do something like FullSimplify[q, a != 0 && b != 0 && k != 0 && (a | b | k) \[Element] Integers]. Feb 22, 2023 at 5:15
• @kirma Can we use PositiveIntegers?
– Syed
Feb 22, 2023 at 5:44
• @Syed cough cough ... one shouldn't write comments right after waking up, especially on sick leave. I wonder where my "natural numbers are all integers except zero" idea came from. There's some ambiguity regarding inclusion of zero on natural numbers, but I guess PositiveIntegers is the most common interpretation. Feb 22, 2023 at 7:03
• Thanks, @Syed! :-) Feb 22, 2023 at 16:12
• You are most welcome. @E.Chan-López
– Syed
Feb 22, 2023 at 16:38