Re: Solving equations and inequalities with Reduce - how?

• To: mathgroup at smc.vnet.net
• Subject: [mg87723] Re: [mg87655] Solving equations and inequalities with Reduce - how?
• From: Daniel Lichtblau <danl at wolfram.com>
• Date: Wed, 16 Apr 2008 05:02:59 -0400 (EDT)
• References: <200804150950.FAA24909@smc.vnet.net>

```Marc Heusser wrote:
> I tried to solve equations with Reduce and somehow did not quite
> formulate it right, so Reduce complains with
> "Reduce::ivar: 1 is not a valid variable".
>
> This is what I tried:
>
> Wanted: A six digit number satisfying the following conditions:
> The first digit is not zero.
> If you take the first two digits and move them to the end of the number,
> the resulting number must be twice the original number.
>
> In[23]:=Reduce[200000a +20000 b +2000 c+200 d+20 e  +       2 f
> \[Equal]100000c +10000 d +1000 e+100 f+10 a  + b ,  {a,b,c,d,e,f},
> Modulus\[Rule]9]
>
> I did solve the problem through exhaustive search:
>
> In[14]:=Timing[Select[Range[10^6],    FractionalPart[#/10000] 1000000 +
> IntegerPart[#/10000]\[Equal] 2  #&]]
> Out[14]={34.2848 Second,{142857,285714,428571}}
>
> but would like to understand how to use Reduce (or another function) to
> solve such a set of equations.
>
> TIA
>
> Marc
>

I realize this has been answered by now, but you might want to have a
look at problem 1 in the notebook at

http://library.wolfram.com/infocenter/Conferences/6530/

Among other things, I'll note that you really need to enforce "one
digitedness" by inequalities, not with a Modulus setting. Along the
lines of that notebook, here is some code for your particular problem.

In[26]:= Reduce[{2*n==100*m+k, n==m+10^4*k, Element[{n,m,k},Integers],
10^4>m>=10^3, 0<=k<=99, n>=10^5}, {n,m,k}]

Out[26]= (n == 142857 && m == 2857 && k == 14) ||
(n == 285714 && m == 5714 && k == 28) ||
(n == 428571 && m == 8571 && k == 42)

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: Re: Solving equations and inequalities with Reduce - how?
• Next by Date: ListPlot & lots 'o dots.
• Previous by thread: Re: Solving equations and inequalities with Reduce - how?
• Next by thread: Re: Solving equations and inequalities with Reduce - how?