I'm trying to solve the following equation in R for x:
(z + x)/y = remainder of zero
In other words, I'm trying to find what value should be added to my number "z" so that it divided by "y" gives a remainder of zero. I couldn't find anything about it so any help would be appreciated!
Since you are referring to a "remainder", I assume you are only dealing with integers.
z <- 8
y <- 7
(x <- ceiling(z / y) * y - z)
#[1] 6
(z + x) %% y
#[1] 0