1
$\begingroup$

For some reason when I type

FindInstance[a + b == c && CoprimeQ[a, b, c] == True, {a, b, c}, Integers]

Mathematica just immediately returns my input as its output, even though the very simple solution {1,2,3} should suffice. Why doesn't it even attempt to solve for this, and how can I fix it?

$\endgroup$
2
$\begingroup$

As with most *Q functions, CoprimeQ will evaluate to True or False immediately:

CoprimeQ[a,b,c]

False

You could instead use GCD:

FindInstance[
    a + b == c && And @@ Thread[GCD @@@ Subsets[{a, b, c}, {2}] == 1],
    {a, b, c},
    Integers
]

{{a -> 1, b -> 0, c -> 1}}

although this approach won't work to find your example.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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