Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have two equations and two unknowns:

$R = \lfloor M * V\rfloor$

$N = \lfloor\frac{X - M}{R}\rfloor + 1$

$V$, $N$, $X$ are known. I need to solve for $R$ and $M$. I'm not sure how to handle the floor function.

share|improve this question
    
$V=M/R$, so $N=\lfloor \frac{X}{R}-V\rfloor +1$. –  Daryl Jan 5 '13 at 7:25
    
Doesn't $V = R / M$? Also, I missed that $R$ is similarly the result of the floor function. –  mjibson Jan 5 '13 at 7:29
    
$N = \lfloor\frac{X}{R} - \frac{1}{V}\rfloor + 1$ is correct, but I'm still unsure how to solve for $R$ in that case. –  mjibson Jan 5 '13 at 7:33
    
Yes, when I replied, there we no floor functions on the first equation though, so you will need a strategy change. –  Daryl Jan 5 '13 at 7:46
add comment

1 Answer 1

Your equations imply that $R\le MV < R+1$ and $N-1 \le (X-M)/R < N$. Therefore, if $R$ can positive, the solution $(M,R)$ with $R>0$ can be any point inside the 2D region bounded by five straight lines: \begin{align} R &\le MV,\\ R &> MV - 1,\\ (N-1)R &\le X-M,\tag{1}\\ X-M &< NR,\tag{2}\\ R&>0,\tag{3}\\ \end{align} with the additional constraint that $R$ is an integer. If $R$ is allowed to be negative, the solution $(M,R)$ with $R<0$ can be found in the analogous way, with the inequality signs in $(1)-(3)$ flipped.

share|improve this answer
    
Why do the equations imply that $MV < R + 1$? Considering the original problem, that is not the case. The constraint is $1 <= R <= M$. If the equations imply that perhaps I stated them incorrectly. –  mjibson Jan 5 '13 at 7:50
    
Foy any real number, you have $\lfloor x\rfloor \le x<\lfloor x\rfloor+1$. Hence the inequality $R\le MV<R+1$. The strict inequality $MV<R+1$ does not contradict $1\le R\le M$ if $V$ can be a number much smaller than $1$. –  user1551 Jan 5 '13 at 8:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.