2
$\begingroup$

I'm trying to solve something like this in Mathematica:

Solve[3*i + j == 5, {i, j}, Integers]

However, I want to specify that the domain is not just integers, but positive integers, so it can actually return the solution {i -> 1, j -> 2}, but I don't know how to do it. Is it possible to do this in Mathematica?

$\endgroup$
  • 2
    $\begingroup$ Help > Documentation Center will take you to the reference page for Solve. Third item under Details and Options indicates how to express inequalities. $\endgroup$ – Daniel Lichtblau Feb 10 '18 at 16:56
3
$\begingroup$
Solve[3*i + j == 5 && i > 0 && j > 0, {i, j}, Integers]

(*  {{i -> 1, j -> 2}}  *)
$\endgroup$

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