Solved

Math problem

Posted on 2006-11-12
7
212 Views
Last Modified: 2010-04-05
Math problem :

x1 = 33
x2 = 66
x3 = 2
x4 = 17
x5 = 25
-----------------
x1+x2+x3+x4+x5=x6=143
33+66+2+17+25=143
-----------------
x1*x2*x3*x4*x5=x7=1851300
33*66*2*17*25=1851300
-----------------
x1/x2/x3/x4/x5=x8=5.8823529411764705882352941176471e-4
33/66/2/17/25=5.8823529411764705882352941176471e-4
-----------------

How to know x1, x2, x3 ,x4 ,x5 if we know x6, x7, x8 ?

Thank You.
0
Comment
Question by:ghjlk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 15

Expert Comment

by:mikelittlewood
ID: 17924625
I could be wrong, but if you have 5 missing variables, do you not need 5 working solutions to get each value.
0
 

Author Comment

by:ghjlk
ID: 17924647
Yes. I have to get x1,x2,x3,x4,x5 from x6,x7,x8 results.

Thank You.
0
 

Author Comment

by:ghjlk
ID: 17924653
Or to use some other results to get x1, x2, x3, x4, x5.

Thank You.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:mikelittlewood
ID: 17924749
I think you misunderstand me.
What I meant to say is, if my old maths is correct, is that you cannot get values for x1, x2, x3, x4, x5 if you only have 3 solutions x6, x7, x8.
You need at least 2 more calculations to make x9 and x10 before you can get x1, x2, x3, x4, x5
0
 

Author Comment

by:ghjlk
ID: 17924756
Please mikelittlewood, if You can make more calculations x9 and x10, because I don't know how to perform correctly results x6, x7 and x8 to get x1, x2, x3, x4 and x5 values.

Thank You.
0
 
LVL 28

Accepted Solution

by:
TName earned 500 total points
ID: 17924776
My faint memories seem to suggest that Mike is right ;)

Try this brute force approach (put a memo and a button on a form):

procedure TForm1.Button1Click(Sender: TObject);
var
x1,x2,x3,x4,x5:Integer;
SL:TStringList;
c,tc:Integer;
cal:Double;
begin
  SL:=TStringList.Create;
  Memo1.Clear;
  tc:=GetTickCount;
  c:=0;
  cal:=33/66/2/17/25;
  //for x1:=1 to 139 do begin
  x1:=33;     //x1 will always be 33. To test, delete "x1:=33;"
                 // and uncomment  "for x1:=1 to 139 do begin" and the additional
                // "end;"  towards the end (above this line: "Memo1.Lines:=SL;")
   for x2:=1 to 139 do begin
     for x3:=1 to 139 do begin
        for x4:=1 to 139 do begin
          for x5:=1 to 139 do begin
             if ((x1+x2+x3+x4+x5=143)  and
                 (x1*x2*x3*x4*x5=1851300) and
                  ((x1/x2/x3/x4/x5>cal-0.000000000000000001) and //To compensate for rounding errors
                  (x1/x2/x3/x4/x5<cal+0.000000000000000001)))then begin

                  SL.Add('x1='+IntToStr(x1)+', '+
                         'x2='+IntToStr(x2)+', '+
                         'x3='+IntToStr(x3)+', '+
                         'x4='+IntToStr(x4)+', '+
                         'x5='+IntToStr(x5));
             end;
             c:=c+1;
          end;
        end;
        Application.ProcessMessages;
      end;
    end;
  //end;
  Memo1.Lines:=SL;
  Memo1.Lines.Add('Milliseconds: '+IntToStr(GetTickCount-tc));
  Memo1.Lines.Add('Loops: '+IntToStr(c));
  beep;
end;
0
 
LVL 28

Expert Comment

by:TName
ID: 17924802
ghjlk,
this is the list of possible solutions I get when I run the above code:

x1=33, x2=2, x3=17, x4=25, x5=66
x1=33, x2=2, x3=17, x4=66, x5=25
x1=33, x2=2, x3=25, x4=17, x5=66
x1=33, x2=2, x3=25, x4=66, x5=17
x1=33, x2=2, x3=66, x4=17, x5=25
x1=33, x2=2, x3=66, x4=25, x5=17
x1=33, x2=5, x3=5, x4=34, x5=66
x1=33, x2=5, x3=5, x4=66, x5=34
x1=33, x2=5, x3=34, x4=5, x5=66
x1=33, x2=5, x3=34, x4=66, x5=5
x1=33, x2=5, x3=66, x4=5, x5=34
x1=33, x2=5, x3=66, x4=34, x5=5
x1=33, x2=17, x3=2, x4=25, x5=66
x1=33, x2=17, x3=2, x4=66, x5=25
x1=33, x2=17, x3=25, x4=2, x5=66
x1=33, x2=17, x3=25, x4=66, x5=2
x1=33, x2=17, x3=66, x4=2, x5=25
x1=33, x2=17, x3=66, x4=25, x5=2
x1=33, x2=25, x3=2, x4=17, x5=66
x1=33, x2=25, x3=2, x4=66, x5=17
x1=33, x2=25, x3=17, x4=2, x5=66
x1=33, x2=25, x3=17, x4=66, x5=2
x1=33, x2=25, x3=66, x4=2, x5=17
x1=33, x2=25, x3=66, x4=17, x5=2
x1=33, x2=34, x3=5, x4=5, x5=66
x1=33, x2=34, x3=5, x4=66, x5=5
x1=33, x2=34, x3=66, x4=5, x5=5
x1=33, x2=66, x3=2, x4=17, x5=25
x1=33, x2=66, x3=2, x4=25, x5=17
x1=33, x2=66, x3=5, x4=5, x5=34
x1=33, x2=66, x3=5, x4=34, x5=5
x1=33, x2=66, x3=17, x4=2, x5=25
x1=33, x2=66, x3=17, x4=25, x5=2
x1=33, x2=66, x3=25, x4=2, x5=17
x1=33, x2=66, x3=25, x4=17, x5=2
x1=33, x2=66, x3=34, x4=5, x5=5

you'll never get ONE answer...

0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question