I have given the following equation, with the additional info that $x$ and $c$ are positive integers and $p$ is a decimal with $0 \le p \le 1$. My goal is to solve for x:
$x = \lfloor xp + c\rfloor$
I've tried the following, however am not quite sure if my last step is correct and am therefore looking for someone to check my solution/provide me with an alternate, correct solution:
x - floor(x*p) = c
$\lceil x - xp\rceil = c$
$x - xp \ge c$
$x(1-p) \ge c$
$x \ge c/(1-p)$
$x = \lceil(c/(1-p))$
I think you need to bind above.
$x \le xp + c < x+1$
$x(1-p) \le c < x(1-p) + 1$
$x \le \frac c{1-p} < x+\frac 1{1-p}$
Unfortunately as $\frac 1{1-p} > 1$ we've found an upper bound of $x$ but no lower bound.
However we can always "shift" and inequality
$x(1-p) \le c < x(1-p)+1\implies$
$x(1-p)-1\le c- 1 < x(1-p) \implies$
$x(1-p)-1\le c- 1 < x(1-p)\le c < x(1-p)+1 \implies$
$c-1 < x(1-p) \le c$ so
$\frac {c-1}{1-p} < x \le \frac c{1-p}$
$\frac c{1-p} -\frac 1{1-p} < x \le \frac c{1-p}$
Any $x$ in that range will do and there may be multiple values of $x$.
For example if $\frac 1{1-p} \ge 3$ then $\frac 13 \ge 1-p$ and $p\ge \frac 23$. So if we let $p=\frac 23$ and if we let $c$ be, say, $7$ we have
$\frac 7{\frac 13}-\frac 1{\frac 13}= 18< x \le 21$ so we can have $x=19,20, 21$.
Check:
$\lfloor xp +c \rfloor = \lfloor \frac 23x +7\rfloor$. If $x = 19,20, 21$ then $\frac 23x= 12\frac 23, 13\frac 13, 14$ and $\frac 23x +7 = 19\frac 23, 20\frac 13,21$ and $\lfloor \frac 23x +7\rfloor=19,20,21 = x$.