flat assembler
Message board for the users of flat assembler.

 Index > Heap > Math Question
Author
victor

Joined: 31 Dec 2005
Posts: 126
Location: Utopia
victor
It seems that many of us are interested in Math challenges. Here is a question I found in a Math & Science journal.

Given that a & b are positive integers and (ab - 1) / (a + b) = 2007. Find the min and max values of the sum (a + b).
25 Mar 2008, 03:34
victor

Joined: 31 Dec 2005
Posts: 126
Location: Utopia
victor
Already worked out the max value, which is (2008 + 4030057) = 4032065.

To find the min value, we may try all integers starting from 4014 and go backward (4013, 4012, 4011, ...), up to 2008.

Any smarter methods?
25 Mar 2008, 03:43
TmX

Joined: 02 Mar 2006
Posts: 821
Location: Jakarta, Indonesia
TmX
This is my idea

Let's assume (ab-1)/(a+b) = 2007/1, so ab-1 = 2007 and a+b = 1

ab - 1 = 2007 --> ab = 2008 ... (1)
a + b = 1 --> a = 1-b ... (2)

Substituting (2) to (1) gives :
(1-b)b = 2008
b - b^2 = 2008
b^2 - b + 2008 = 0

Well, the solution is irrational numbers, so (a+b) must be > 1
25 Mar 2008, 03:50
AlexP

Joined: 14 Nov 2007
Posts: 561
Location: Out the window. Yes, that one.
AlexP
Brute force!!!
25 Mar 2008, 04:45
r22

Joined: 27 Dec 2004
Posts: 805
r22
(((2007*y+1)/(y-2007)) * y - 1) / (((2007*y+1)/(y-2007)) + y) = 2007
...
...
...
funny Victor
25 Mar 2008, 19:55
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsCompiler InternalsIDE DevelopmentOS ConstructionNon-x86 architecturesHigh Level LanguagesProgramming Language DesignProjects and IdeasExamples and Tutorials Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou can attach files in this forumYou can download files in this forum