Sei sulla pagina 1di 2

Late-night Math Puzzles That Im Using As An A Excuse To Practice L TEX

GManNickG April 13, 2012


Let a, b, and c be distinct positive real numbers such that a + b = x2 , a + c = y 2 , and b + c = z 2 , where x, y, and z are integers. Find the minimum 2 2 2 value of a + b + c = x +y +z . 2 First note that x2 , y 2 , and z 2 are all unique1 . Without loss of generalization, let x2 < y 2 < z 2 , then iterate incrementally over the perfect squares (ordering by the sum of the squares) until all the constraints are satised: x2 1 1 1 4 4 4 9 9 9 16 y2 4 4 9 9 9 16 16 16 25 25 z2 9 16 16 16 25 25 25 36 36 36

a 2
11 2

b 3
13 2

c 6
19 2

Sum 7
21 2

Valid No No No No No No No No No Yes

3
3 2

4
11 2

12
21 2

13
29 2

6
5 2

10
13 2

15
37 2

19
45 2

0
11 2

9
29 2

16
43 2

25
61 2

1
5 2

10
27 2

26
45 2

35
77 2

At the tenth iteration the rst valid conguration occurs, and the problem is solved. The Haskell program to generate tables is listed below:
1 Let x2 = y 2 = S, then a + b = S and a + c = S, ergo b = c, a contradiction. Therefore x2 = y 2 . Similar argument for the other pairings.

-- Warning : I m an idiot and I m learning Haskell , code may suck . import Ratio -- Pretty - format a fraction strFraction _ 0 = error " Division by zero . " strFraction 0 _ = " 0 " strFraction n 1 = show n strFraction n d = show n ++ " / " ++ show d -- Pretty - print a fraction , reducing the fraction strFractionReduced n d = let x = n % d in strFraction ( numerator x ) ( denominator x ) -- Solve system strValueA x y z strValueB x y z strValueC x y z strSumABC x y z of equations = strFractionReduced = strFractionReduced = strFractionReduced = strFractionReduced

(x (z (y (x

z y x y

+ + + +

y) x) z) z)

2 2 2 2

-- Check if A , B , and C are positive isValid x y z = ( x - z + y ) > 0 && ( z - y + x ) > 0 && ( y - x + z ) > 0 -- - Full test strTriple x y z = " X ^2= " ++ show x ++ " Y ^2= " ++ show y ++ " Z ^2= " ++ show z ++ " A = " ++ ( strValueA x y z ) ++ " B = " ++ ( strValueB x y z ) ++ " C = " ++ ( strValueC x y z ) ++ " Sum = " ++ ( strSumABC x y z ) ++ " Valid : " ++ show ( isValid x y z ) -- Power " bases " , square root of the perfect square sequence -- X : 1 , 1 , 1 , 2 , 2 , 2 , 3 , 3 , 3 , ... -- Y : 2 , 2 , 3 , 3 , 3 , 4 , 4 , 4 , 5 , ... -- Z : 3 , 4 , 4 , 4 , 5 , 5 , 5 , 6 , 6 , ... xPowerBase n = n quot 3 + 1 yPowerBase n = xPowerBase ( n + 4) zPowerBase n = yPowerBase ( n + 4) -- Actual perfect squares -- X : 1 , 1 , 4 , 4 , 9 , 9 , ... -- Y : 4 , 4 , 9 , 9 , 16 , 16 , ... -- Z : 9 , 16 , 16 , 25 , 25 , 36 , ... xPower n = ( xPowerBase n )^2 yPower n = ( yPowerBase n )^2 zPower n = ( zPowerBase n )^2 -- Generate table testIterations n = mapM_ putStrLn [ show n ++ " : " ++ strTriple ( xPower n ) ( yPower n ) ( zPower n ) ++ " \ n " | n <- [0.. n ]]

Potrebbero piacerti anche