What are all the ordered triples of positive integers (x,y,z) with x<y<z, such that their product is four times their sum?
The following MS-DOS QBasic program finds the same results a Fernando.
I actually ran it with z finishing at 100. I have reset it to 1000 in this listing but it takes forever; thinking about a C version.
There is however a problem with these solutions, not the solution as such, nor the program. What is missing is an argument as why these may/not be the only solutions. I note that the results have the following primes as factors in one form or another: 1, 2, 3, 5 and 7.
My concern for a justifiable argument is that if I start with 1, 2 and P as my factors then 1*2*P < 4*(1+2+P) no matter how large P might be.
--------------------------------------------------------------------
The program:(Needs some tidying but it works!)
CLS
' x < y < z
' x is also greater that 0
m = 1
y = 2
z = 3
FOR a = 0 TO 4 'Provides for x to be incremented
FOR x = a TO y - 1
FOR y = x + 1 TO z - 1
FOR z = y + 1 TO 1000
LOCATE m, 1 'Overwrite invalid results to avoid
' scrolling loss of valid results
PRINT "a"; a; "x"; x; "y"; y; "z"; z;
Prod = x * y * z
sum = x + y + z
Foursum = 4 * sum
IF Prod = Foursum THEN
' LOCATE m, 20
PRINT "prod"; Prod; "sum"; Foursum; "x,y,z"; x; y; z
m = m + 1 'Having located and printed a valid
'result locate for next values.
END IF
NEXT
NEXT
NEXT
NEXT
|
Posted by brianjn
on 2007-11-23 21:11:10 |