[email protected] wrote:If a and b are integers, and |a| > |b|, is a · |b| < a - b?
(1) a < 0
(2) ab >= 0
anybody have a solution for this (under 2 minute). testing value takes way too long here.
E
You could try this, but it still takes a few minutes:
As |a| > |b| and |a| < 0, then |b| < 0 too
Now we can limit our testing:
If we let |a| = p + k, |b| = p, then a = -(p + k) and b = -p where p > 0, k > 0 are unknown.
So, looking at the question "is a*|b| < a - b?"
The LHS is a · |b| = -(p + k)*p = -p(p + k)
and the RHS is a - b = -(p + k)--p = -k
So the question becomes: is -p(p + k) < -k ?
Add k to both sides:
-p^2 - kp + k < 0
p^2 + kp - k > 0 (changing sign changes the inequality symbol)
Solve:
p -> [-k +/- SQRT(k^2 + 4k)]/2 which is real and solvable; so it is possible. Integer solutions are findable.
However, the quadratic curve will intersect the p axis to define acceptable and unacceptable ranges.
Therefore it is unsufficient.