5 MinVal=9999999999999:MaxVal=0
10 D$="123456789":H$=D$
20 loop
40 Tval=0
50 for I=1 to 7 step 3
60 Term=(val(mid(D$,I,1))//val(mid(D$,I+1,1)))^val(mid(D$,I+2,1))
70 Tval=Tval+Term
80 next
85 if Tval=int(Tval) then Ct=Ct+1
90 :if Tval<=MinVal then MinVal=Tval:MinStr=D$:gosub *PrIt:endif
100 :if Tval>=MaxVal then MaxVal=Tval:MaxStr=D$:gosub *PrIt
110
390 gosub *Permute(&D$)
398 if D$=H$ then goto 400
399 endloop
400 print MinStr,MinVal
410 print MaxStr,MaxVal
420 print Ct
690 close
700 end
800
810 *PrIt
820 print "(";mid(D$,1,1);"/";mid(D$,2,1);")^";mid(D$,3,1);" + ";
822 print "(";mid(D$,4,1);"/";mid(D$,5,1);")^";mid(D$,6,1);" + ";
824 print "(";mid(D$,7,1);"/";mid(D$,8,1);")^";mid(D$,9,1);" = ";
826 print Tval
830 return
produces a set of results with decreasing minimum and increasing maximum values. Selected from them are:
The final minimum is 70, given in the six permutations of its terms:
(5/9)^1 + (7/3)^2 + (8/4)^6 = 70
(5/9)^1 + (8/4)^6 + (7/3)^2 = 70
(7/3)^2 + (5/9)^1 + (8/4)^6 = 70
(7/3)^2 + (8/4)^6 + (5/9)^1 = 70
(8/4)^6 + (5/9)^1 + (7/3)^2 = 70
(8/4)^6 + (7/3)^2 + (5/9)^1 = 70
The maximum, 134,217,888, is given by terms two of whose bases amount to 2: 6/3 and 4/2. As a result, these can be interchanged with their powers, 7 and 5, making a total of 12 variations on the theme:
(4/2)^5 + (6/3)^7 + (8/1)^9 = 134217888
(4/2)^5 + (8/1)^9 + (6/3)^7 = 134217888
(4/2)^7 + (6/3)^5 + (8/1)^9 = 134217888
(4/2)^7 + (8/1)^9 + (6/3)^5 = 134217888
(6/3)^5 + (4/2)^7 + (8/1)^9 = 134217888
(6/3)^5 + (8/1)^9 + (4/2)^7 = 134217888
(6/3)^7 + (4/2)^5 + (8/1)^9 = 134217888
(6/3)^7 + (8/1)^9 + (4/2)^5 = 134217888
(8/1)^9 + (4/2)^5 + (6/3)^7 = 134217888
(8/1)^9 + (4/2)^7 + (6/3)^5 = 134217888
(8/1)^9 + (6/3)^5 + (4/2)^7 = 134217888
(8/1)^9 + (6/3)^7 + (4/2)^5 = 134217888
|
Posted by Charlie
on 2009-02-09 12:51:16 |