The 97 rational numbers 49/1, 49/2, 49/3, ..., 49/97 are written on a blackboard.
Two of the above numbers X and Y are chosen and replaced by X*Y-X-Y+1.
The procedure is repeated until a single number Z(say) remains on the board.
Determine the possible values of Z.
The following program evaluates a reduced version of the given set: just the first four values. There are 5!! = 1*3*5 = 15 potential results, and in fact, each of these results is indeed different, as UBASIC shows the resulting fractions in reduced form. It also uses double virgules rather than single, to separate denominator from numerator.
4 open "ratvalv2.txt" for output as #2
30 dim V(4)
36 for I=1 to 4
37 V(I)=49//I
38 next
39 a=v(1):b=v(2):c=v(3):d=v(4)
40 print #2,fnF(fnF(fnF(a,b),c),d)
50 print #2,fnF(fnF(fnF(a,b),d),c)
60 print #2,fnF(fnF(fnF(a,c),b),d)
70 print #2,fnF(fnF(fnF(a,c),d),b)
80 print #2,fnF(fnF(fnF(a,d),b),c)
90 print #2,fnF(fnF(fnF(a,d),c),b)
100 print #2,fnF(fnF(fnF(b,c),a),d)
110 print #2,fnF(fnF(fnF(b,c),d),a)
120 print #2,fnF(fnF(fnF(b,d),a),c)
130 print #2,fnF(fnF(fnF(b,d),c),a)
140 print #2,fnF(fnF(fnF(c,d),a),b)
150 print #2,fnF(fnF(fnF(c,d),b),a)
160
170 print #2, fnF(fnF(a,b),fnF(c,d))
180 print #2, fnF(fnF(a,c),fnF(b,d))
190 print #2, fnF(fnF(a,d),fnF(b,c))
310 close #2
399 end
400 fnF(x,y)
410 local vl
420 vl=x*y-x-y+1
430 return(vl)
777585//4
1166353//6
1554435//8
1554337//8
582613//3
1165177//6
776115//4
193992
581486//3
193796
386857//2
193404
386561//2
1548645//8
581042//3
|
Posted by Charlie
on 2016-03-22 08:12:50 |