# Range of values which not satisfy an equation?

Let $$x+5=z\tag1$$

1. How can i obtain all the values of $$0 which don't satisfy the given relation. Edit: of course $$x$$ and $$z$$ are positive integers.

2. What command should i use to find the first instance and to stop the calculations.

How many ways exist in mathematica to sort out only numbers which don't satisty a given relation.

This may appear straighforward for most of you, but thank you so much for your kind welcome.

• What does $y$ have to do with anything? Nov 11, 2023 at 21:00
• Thank you. Edited. It was a typo error Nov 12, 2023 at 14:36

Perhaps

FindInstance[! (x + 5 == z) && 0 < x < 10, {x, z}, Reals, 10]

(*
{{x -> 638/101, z -> -1}, {x -> 919/101, z -> 106},
{x -> 134/101,z -> -36}, {x -> 816/101, z -> -33},
{x -> 950/101,z -> 103}, {x -> 642/101, z -> -52},
{x -> 744/101,z -> 79}, {x -> 709/101, z -> 88},
{x -> 769/101,z -> -27}, {x -> 713/101, z -> 51}}
*)


Only integer solution

sol=FindInstance[! (x + 5 == z) && 0 <= x <= 10, {x, z}, Integers,10]
SortBy[sol, (x /. # &)]
(*{{x -> 1, z -> 277}, {x -> 3, z -> -981},
{x -> 3,z -> -490}, {x -> 3, z -> 703},
{x -> 4, z -> 694}, {x -> 6,z -> 10}, {x -> 6, z -> 386},
{x -> 7, z -> -618}, {x -> 8,z -> 14}, {x -> 8, z -> 198}}*)

• Thank you so much. Maybe should i precise that $x$ and $z$ are positive integers. And i am looking for the smallest vallue of $x$ for the instance. Nov 11, 2023 at 16:24
• Try sol=FindInstance[! (x + 5 == z) && 0 <= x <= 10, {x, z}, Integers, 10] and select the instance with smallest x SortBy[sol, (x /. # &)] Nov 11, 2023 at 16:31
• Thank you so much. Nov 11, 2023 at 16:34
• You are welcome! Nov 11, 2023 at 16:35
• @DavidG.Stork I gave the right answer in my comment (UlrichNeumann has noticed it after all ;-)) and forgot to modify my answer. Done! Nov 12, 2023 at 15:18