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

Home > Numbers
As low as possible (Posted on 2013-04-12) Difficulty: 2 of 5
What is the lowest value of a product of two positive numbers a and b, given that a+b=a*b?

See The Solution Submitted by Ady TZIDON    
Rating: 2.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution pretty pictures | Comment 1 of 6

The answer is 4, for a=b=2.

The following program will run in QB4.5 or QB64, producing a first quadrant colored yellow where x*y>x+y and blue where x*y<x+y, overlaid with hyperbolae for different values of x*y, and the value 4 is tangent to the boundary of the yellow and the blue areas. Also the line for x=y is shown:

SCREEN 12 ' 640 x 480
DEFDBL A-Z
xmax = 5#: xmin = 0#: xr = xmax - xmin: sc = 640 / xr
ymin = xmin


' Color yellow areas where x*y>x+y and blue where x*y<x+y (black if equal)

FOR x = xmin TO xmax STEP 1 / sc
    FOR y = ymin TO ymin + 479 / sc STEP 1 / sc
        IF x * y > x + y THEN
            COLOR 14
        ELSEIF x * y = x + y THEN
            COLOR 0
        ELSE
            COLOR 9
        END IF
        PSET ((x - xmin) * sc, (479 - (y - ymin) * sc))
    NEXT
NEXT
COLOR 0

' Draw hyperbolae for values of x*y (i.e., xy) and line y=x

FOR xy = 1# TO 5 STEP .5
    FOR x = xmin + 1 / sc TO xmin + 639 / sc STEP 1 / sc
        y = xy / x
        IF y > ymin AND y <= ymin + 479 / sc THEN
            PSET ((x - xmin) * sc, (479 - (y - ymin) * sc))
        END IF
        y = x
        IF y > ymin AND y <= ymin + 479 / sc THEN
            PSET ((x - xmin) * sc, (479 - (y - ymin) * sc))
        END IF
    NEXT
NEXT


DO: LOOP UNTIL INKEY$ > ""

A finer-grained view near the point of tangency is provided with:

SCREEN 12 ' 640 x 480
DEFDBL A-Z
xmax = 2.2#: xmin = 1.8#: xr = xmax - xmin: sc = 640 / xr
ymin = xmin


' Color yellow areas where x*y>x+y and blue where x*y<x+y (black if equal)

FOR x = xmin TO xmax STEP 1 / sc
    FOR y = ymin TO ymin + 479 / sc STEP 1 / sc
        IF x * y > x + y THEN
            COLOR 14
        ELSEIF x * y = x + y THEN
            COLOR 0
        ELSE
            COLOR 9
        END IF
        PSET ((x - xmin) * sc, (479 - (y - ymin) * sc))
    NEXT
NEXT
COLOR 0

' Draw hyperbolae for values of x*y (i.e., xy)

FOR xy = 3.9# TO 4.101# STEP .05
    FOR x = xmin + 1 / sc TO xmin + 639 / sc STEP 1 / sc
        y = xy / x
        IF y > ymin AND y <= ymin + 479 / sc THEN
            PSET ((x - xmin) * sc, (479 - (y - ymin) * sc))
        END IF
        y = x
        IF y > ymin AND y <= ymin + 479 / sc THEN
            PSET ((x - xmin) * sc, (479 - (y - ymin) * sc))
        END IF
    NEXT
NEXT


DO: LOOP UNTIL INKEY$ > ""

 


  Posted by Charlie on 2013-04-12 12:40:29
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 (7)
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