Re: number theory
- To: mathgroup@smc.vnet.net
- Subject: [mg12537] Re: number theory
- From: Bill Bertram <wkb@ansto.gov.au>
- Date: Sat, 23 May 1998 18:11:03 -0400
- Organization: ANSTO
- References: <6jom3j$k8r@smc.vnet.net>
Thomas A. Rice wrote: > > I have been trying to use Mathematica to get integer solutions to > problems, but am beating my head against the wall. > > Can one use Mathematica to give an exact solution in a situation like > the following? > > An automobile travels at a speed exactly 20 times faster than John can > walk, but less than 65 mph. John walks exactly at a whole number speed > (integer) between 1 and 4 mph (1, 2, 3, or 4 mph). What are the speeds > the car might travel? > > Answer: 20, 40, or 60 mph. > > It doesn't work for me to enter: > > Solve[{IntegerPart[walking] * 20 == driving, walking >0, walking < 5, > driving < 66}, driving] > > I would be greatly indebted if someone could tell me if or how this > problem can be solved with Mathematica. I dont see that this problem is really one of finding integer solutions. After all, if the input "walking" is an integer then the solution for "driving" will automatically be an integer. Therefore the way I would go about solving this in mathematica would be something like: walking=0; While[20(++walking) < 66, Print[20 walking]] which gives you the results you want. Hope this helps. Cheers, Bill