       Re: Re: Diophantic equations

• To: mathgroup at smc.vnet.net
• Subject: [mg32788] Re: [mg32771] Re: [mg32746] Diophantic equations
• From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
• Date: Sat, 9 Feb 2002 23:39:34 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```In my original reply I failed to notice you only wanted non-negative
solutions. One can of course obtain them from the solution below by
trying various values for m, but if you prefer to do it more
automatically here is one way:

First load the InequalitySolve package:
In:=
<< "Algebra`InequalitySolve`"

since a and b have to be >=0 we must have:

In:=
InequalitySolve[{6300 + m*19 >= 0, -16200 - m*49 >= 0}, {m}]

Out=
-(6300/19) <= m <= -(16200/49)

In other words:

In:=
N[%]

Out=
-331.57894736842104 <= m <= -330.61224489795916

There is only one such integer

In:=
m = -331;

thus

In:=
a = 6300 + m*19

Out=
11

In:=
b = -16200 - m*49

Out=
19

In:=
c = 100 - 5*a - 2*b

Out=
7

Andrzej Kozlowski
Toyama International University
JAPAN
http://platon.c.u-tokyo.ac.jp/andrzej/

On Saturday, February 9, 2002, at 07:11  PM, Andrzej Kozlowski wrote:

> Here is how to do it in your case. You can use this method to solve more
> general linear cases.
>
> First eliminate one variable from the equations:
>
> In:=
> eqs={a+b+10 c==100,5 a+2 b+c==100}
>
> In:=
> Eliminate[eqs,{c}]
>
> Out=
> 900-19 b==49 a
>
> Clearly we only need to find all integer solutions of the equation  49
> a + 19 b == 900, since c will then be given by c=100-a-2b.
>
> The next step is to find just a single integer solution. The general way
> to do this is to use the Euclidean algorithm.
>
> In:=
> ExtendedGCD[49,19]
>
> Out=
> {1,{7,-18}}
>
> This tells us that:
>
> In:=
> 7*49-18*19
>
> Out=
> 1
>
>  From this we see at once that a solution will be given by:
>
> In:=
> a=900*7
>
> Out=
> 6300
>
> In:=
> b=900*-18
>
> Out=
> -16200
>
> indeed
>
> In:=
> 49 a+19 b
>
> Out=
> 900
>
> Now that we have one solution (a,b) all the other solutions are given by
> (a+m 19,b-m 49) = (6300+ m*19,-16200-m*49) where m is  any integer.
> Indeed:
>
> In:=
> {6300+m*19,-16200-m*49}.{49,19}//Simplify
>
> Out=
> 900
>
>
>
> On Friday, February 8, 2002, at 05:49  PM, Max Ulbrich wrote:
>
>> Hi,
>>
>> I try to solve equations where only integers are allowed, like
>>
>> a + b + 10 c = 100
>> 5 a + 2 b + c = 100
>>
>> a, b, c should be integers and positve.
>>
>> How can I do this?
>>
>> Max
>>
>>
>>
>>
>>
>
>
>

```

• Prev by Date: Re: finite fields
• Next by Date: Ailing Palette Buttons
• Previous by thread: Re: Diophantic equations
• Next by thread: FullSimplify doesn't simplify