1
   

( _ / _ _ ) + ( _ / _ _ ) + ( _ / _ _ ) = 1

 
 
ayrlass
 
Reply Wed 12 Apr, 2006 06:28 am
Does anyone have a solution to this please??!

Put the digits from one to nine (using each one once and only once) in the following equation so that the left-hand side is equal to 1.

( _ / _ _ ) + ( _ / _ _ ) + ( _ / _ _ ) = 1

For example:

(1/35) + (2/46) + (8/79) = 0.173
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 1,350 • Replies: 22
No top replies

 
FreeDuck
 
  1  
Reply Wed 12 Apr, 2006 08:00 am
Are negatives allowed? Otherwise it doesn't seem possible.
0 Replies
 
McTag
 
  1  
Reply Wed 12 Apr, 2006 08:34 am
(9/34)+(8/12)+(7/56)=1.0564

Is it possible to get closer? Don't think so.
0 Replies
 
FreeDuck
 
  1  
Reply Wed 12 Apr, 2006 08:43 am
FreeDuck wrote:
Are negatives allowed? Otherwise it doesn't seem possible.


Nevermind, I was suffering a momentary lapse of judgment.
0 Replies
 
Thomas
 
  1  
Reply Wed 12 Apr, 2006 10:10 am
I think this takes a brute force approach. There are 9! = 362880 positions to try out, meaning that many divisions and subtractions. It should be doable. Anybody know an elegant way to iterate over all permutations of a set? It seems to be trickier than you't think at first sight.
0 Replies
 
engineer
 
  1  
Reply Wed 12 Apr, 2006 11:48 am
McTag wrote:
(9/34)+(8/12)+(7/56)=1.0564

Is it possible to get closer? Don't think so.


I got closer with 8/12 + 9/36 + 4/57 = .987, but still no correct answer.

Quote:
I think this takes a brute force approach. There are 9! = 362880 positions to try out, meaning that many divisions and subtractions.


You can reduce this slightly (by 3!) since the three terms are interchangable and you know that the first number of one of the demoninators must be 1, but I'm surprised no one has posted his computer program yet.
0 Replies
 
jespah
 
  1  
Reply Wed 12 Apr, 2006 03:57 pm
9/12+8/35+7/46 = .75+.22...+.152... = 1.12...

Hmm I think you want 9/12 or as close to 1 as possible, then jigger the others.
0 Replies
 
ayrlass
 
  1  
Reply Thu 13 Apr, 2006 08:15 am
i got it!

9/12+5/34+7/68 = 1
0 Replies
 
Thomas
 
  1  
Reply Thu 13 Apr, 2006 11:01 am
Congratulations! May I ask how you found out? Brute force? If not, did you follow any particular strategy?
0 Replies
 
engineer
 
  1  
Reply Thu 13 Apr, 2006 11:17 am
I did a brute force computer program. Takes a while, but the programming was straight forward. Ayrlass beat me to it though.
0 Replies
 
ebrown p
 
  1  
Reply Thu 13 Apr, 2006 11:44 am
Did you find any other solutions (other than those generated by the obvious rearranging of terms) ?
0 Replies
 
engineer
 
  1  
Reply Thu 13 Apr, 2006 01:19 pm
No, but there were several that got very close like...

9/12 + 4/37 + 8/56 = 1.001
9/12 + 5/63 + 8/47 = 1.0004
9/13 + 5/87 + 6/24 = 1.0002
0 Replies
 
Heliotrope
 
  1  
Reply Thu 13 Apr, 2006 02:03 pm
engineer wrote:
I did a brute force computer program. Takes a while, but the programming was straight forward. Ayrlass beat me to it though.

I'd be very interested to see that code.
Would you mind sharing it ?
0 Replies
 
engineer
 
  1  
Reply Thu 13 Apr, 2006 02:32 pm
Code
Heliotrope wrote:
engineer wrote:
I did a brute force computer program. Takes a while, but the programming was straight forward. Ayrlass beat me to it though.

I'd be very interested to see that code.
Would you mind sharing it ?


I don't mind if you don't laugh. Since all I had at hand was Excel, I wrote it as a VB Excel macro and used spreadsheet cells as variables. Cells A1-A9 were the nine values. I set A1 to 1 since I knew the first digit in the first denominator was 1. I set A2 to 9 since I knew it was a big number and had it decrease instead of increasing. The rest I set to two before starting the macro. I set cell B1 to be the sum of the numbers in A1:A9, B2 to be the product and B3 to be the formula we wanted. That said, here is the code. You could easily replace the cells with an array in a non-Excel environment. Remember no laughing. I can write much better code, honest.



Public Sub SolvePuzzle()
Dim i As Integer

' Cells A2 through A9 hold the numbers 2 through 9
' The tens digit in the denominator of the first number must be 1
Do While Range("a2") > 1
' Count downward for the numerator of the first variable since I know it has to be big
Do While Range("a3") < 10
Do While Range("a4") < 10
Do While Range("a5") < 10
Do While Range("a6") < 10
Do While Range("a7") < 10
Do While Range("a8") < 10
Do While Range("a9") < 10

' If all the numbers from 1 to 9 are in place, the sum is 45 and the product is 362880
If Range("b1") = 45 And Range("b2") = 362880 And Range("b3") < 0.00001 Then
Stop
End If
Range("a9") = Range("a9") + 1
Loop
Range("a8") = Range("a8") + 1
Range("a9") = 2
Loop
Range("a7") = Range("a7") + 1
Range("a8") = 2
Loop
Range("a6") = Range("a6") + 1
Range("a7") = 2
Loop
Range("a5") = Range("a5") + 1
Range("a6") = 2
Loop
Range("a4") = Range("a4") + 1
Range("a5") = 2
Loop
Range("a3") = Range("a3") + 1
Range("a4") = 2
Loop
' Remember I am decrementing the value in A2
Range("a2") = Range("a2") - 1
Range("a3") = 2
Loop


End Sub
0 Replies
 
McTag
 
  1  
Reply Fri 14 Apr, 2006 03:06 am
Most impressive.

Congratulations, engineer.
0 Replies
 
markr
 
  1  
Reply Fri 14 Apr, 2006 12:33 pm
This runs in less than a second on my 2.4GHz machine. It checks only permutations of the digits 2-9, and uses only integer math. I multiplied the original expression by the product of the denominators to come up with a new expression without fractions. It finds two identical solutions (swap the fractions without 1 in the denominator).

From what I can tell, the VB solution is checking many invalid (duplicate digits) configurations and uses floating point math. However, probably the worst performance hit is refreshing the display, unless screen updating is turned off during the program.

NextPerm() is a function I found somewhere (and use quite a bit to solve problems like this). It outputs permutations in lexicographic order (assuming the data is sorted to begin with). The only thing I don't like about this particular implementation is that it uses an extra position (the first position) in the array.

Code:#include <stdio.h>

#define N 8

long d[N+1] = {0, 2, 3, 4, 5, 6, 7, 8, 9};

void Swap(int i, int j)
{
long temp;

temp = d[i];
d[i] = d[j];
d[j] = temp;
}

int NextPerm()
{
int j, k, r, s;

k = N-1;
while (d[k] > d[k+1])
k--;
if (k == 0)
return(0);
else {
j = N;
while (d[k] > d[j])
j--;
Swap(j, k);
r = N;
s = k + 1;
while (r > s) {
Swap(r, s);
r--;
s++;
}
}
return(1);
}

void main(void)
{
long d1, d2, d3;

do {
d1 = 10 + d[2];
d2 = 10*d[4] + d[5];
d3 = 10*d[7] + d[8];
if ((d[1]*d2*d3 + d[3]*d1*d3 + d[6]*d1*d2) == d1*d2*d3)
printf("%ld/1%ld + %ld/%ld%ld + %ld/%ld%ld = 1\n",
d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8]);
} while (NextPerm());
}
0 Replies
 
Heliotrope
 
  1  
Reply Fri 14 Apr, 2006 01:52 pm
Engineer and Markr,
Thanks guys.
Good code.

The Excel twist is fortuitous because I was going to have to turn whatever you had into something Excel could work with but you've already done it !
Top man.

Thanks again dudes.

D
0 Replies
 
markr
 
  1  
Reply Fri 14 Apr, 2006 02:01 pm
I just noticed that the indentation in my code got screwed up.

Heliotrope:

You may already be aware of this, but if you place this:
Application.ScreenUpdating = False
at the beginning of your code
and this:
Application.ScreenUpdating = True
at the end of your code, it will run much faster.

I suspect declaring and using variables instead of cells will also improve performance.
0 Replies
 
Thomas
 
  1  
Reply Sat 15 Apr, 2006 03:56 am
markr wrote:
This runs in less than a second on my 2.4GHz machine. It checks only permutations of the digits 2-9, and uses only integer math.

Okay, I'll bite: Why can you ignore permutations of the digit 1?
0 Replies
 
markr
 
  1  
Reply Sat 15 Apr, 2006 10:42 am
I noticed the comment in engineer's post and thought he made a mistake until I checked it out.

The expression is maximized when the denominators are as small as possible. If the 1 can't be a tens digit in a denominator, then the maximum is
A/2B + C/3D + E/4F = 1
where A, C, and E are some permutation of 7, 8, and 9.

Turns out, the maximum is less than 1.
0 Replies
 
 

Related Topics

Evolution 101 - Discussion by gungasnake
Typing Equations on a PC - Discussion by Brandon9000
The Future of Artificial Intelligence - Discussion by Brandon9000
The well known Mind vs Brain. - Discussion by crayon851
Scientists Offer Proof of 'Dark Matter' - Discussion by oralloy
Blue Saturn - Discussion by oralloy
Bald Eagle-DDT Myth Still Flying High - Discussion by gungasnake
DDT: A Weapon of Mass Survival - Discussion by gungasnake
 
  1. Forums
  2. » ( _ / _ _ ) + ( _ / _ _ ) + ( _ / _ _ ) = 1
Copyright © 2025 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.05 seconds on 04/30/2025 at 07:51:03