MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Diophantic Equations with Constraints


Using brute force (not recommended):


Select[
   Flatten[
     Table[
       {x,y,z},
       {x,3,8},{y,0,12},{z,1,9}],
     2],
   (3*#[[1]]+2*#[[2]]-#[[3]]==14&)]


{{3, 3, 1}, {3, 4, 3}, {3, 5, 5}, {3, 6, 7}, {3, 7, 9}, 
   {4, 2, 2}, {4, 3, 4}, {4, 4, 6}, {4, 5, 8}, {5, 0, 1}, 
   {5, 1, 3}, {5, 2, 5}, {5, 3, 7}, {5, 4, 9}, {6, 0, 4}, 
   {6, 1, 6}, {6, 2, 8}, {7, 0, 7}, {7, 1, 9}}


Using Reduce over the domain Integers:


% == ({x,y,z} /. {ToRules[
             Reduce[
               {3x+2y-z==14,
                 3<=x<=8,0<=y<=12,1<=z<=9},{x,y,z}, Integers]]} // Sort)


True


Bob Hanlon

> In a message dated Tue, 20 Jul 2004 12:06:58 +0000 (UTC), <
> MikeSuesserott at t-online.de> writes: given an equation like
> 
>      3x + 2y - z == 148
> with
> x in Range[3,8],
> y in Range[0,12],
> z in Range[1,9],
> 
> what would be the best way to solve this?
> 


  • Prev by Date: Re: Diophantic Equations with Constraints
  • Next by Date: RE: Diophantic Equations with Constraints
  • Previous by thread: Re: Diophantic Equations with Constraints
  • Next by thread: RE: Diophantic Equations with Constraints