All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Minimizing n (Posted on 2016-03-23) Difficulty: 3 of 5
ŠGiven:
i. a, b, c, d, e, f, g, h are distinct positive integers.
ii. ab+cd=ef+gh=n

Find the minimum value of n.

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer confirmation (solution) Comment 2 of 2 |
DefDbl A-Z
Dim crlf$, used(30)

Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)
 
 minimum = 100
 
 For a = 1 To 23
   used(a) = 1
 For b = a + 1 To 30
   used(b) = 1
 For c = a + 1 To 29
   If used(c) = 0 Then
     used(c) = 1
 For d = c + 1 To 30
   If used(d) = 0 Then
     used(d) = 1
 For e = a + 1 To 29
   If used(e) = 0 Then
     used(e) = 1
     DoEvents
 For f = e + 1 To 30
   If used(f) = 0 Then
     used(f) = 1
 For g = e + 1 To 29
   If used(g) = 0 Then
     used(g) = 1
 For h = g + 1 To 30
   If used(h) = 0 Then
     used(h) = 1
       If a * b + c * d = e * f + g * h Then
        If a * b + c * d <= minimum Then
         Text1.Text = Text1.Text & Str(a) & Str(b) & Str(c) & Str(d) & Str(e) & Str(f) & Str(g) & Str(h) & "  " & a * b + c * d & crlf
         minimum = a * b + c * d
        End If
       End If
     used(h) = 0
   End If
 Next
     used(g) = 0
   End If
 Next
     used(f) = 0
   End If
 Next
     used(e) = 0
   End If
 Next
     used(d) = 0
   End If
 Next
     used(c) = 0
   End If
 Next
  used(b) = 0
 Next
  used(a) = 0
 Next
   
 Text1.Text = Text1.Text & minimum & crlf & " done"
  
End Sub

finds the minimum is 31, per:

 1 2 3 19 4 6 5 7  59
 1 2 4 13 3 8 5 6  54
 1 2 5 10 3 8 4 7  52
 1 2 6 7 3 8 4 5  44
 1 4 5 7 2 6 3 9  39
 1 5 3 11 2 7 4 6  38
 1 6 3 10 2 8 4 5  36
 1 6 4 7 2 5 3 8  34
 1 7 3 9 2 5 4 6  34
 1 7 4 6 2 8 3 5  31
 
where the last, best, line represents

1*7 + 4*6 = 2*8 + 3*5 = 31

where a had to be the smallest number of all 8
b had to be larger than a (of course)
same with c larger than a 
d larger than c
e larger than a
f larger than e
g larger than e
h larger than g

wlog. The rules merely eliminate trivial variations.

  Posted by Charlie on 2016-03-23 13:34:40
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information