Sometimes an arithmetic procedural error produces a correct answer.
An accidental cancellation is reducing a fraction by canceling individual digits in the numerator and denominator.
In some cases the result is equal to that obtained by a correct process.
Examples:
16/64 = 16/64 = 1/4;
26/65 = 26/65 = 2/5;
266/665 = 266/665 = 2/5;
49/98 = 4/8 = 1/2 etc.
Try to find two-digit cases in bases other than base 10,(e.g. 13/32 = 1/2 ( the only solution in base 4).
(In reply to
re: computer solutions -a partial errata by Ady TZIDON)
Ah yes, you're so right. I neglected the very important fact that the canceled digits had to be equal to each other!
I've fixed the program, and extended to base 20 as there are fewer results. Sorry about that.
13/32=1/2 4
15/53=1/3 6
25/54=2/4 6
17/74=1/4 8
37/76=3/6 8
14/43=1/3 9
28/86=2/6 9
16/64=1/4 10
19/95=1/5 10
26/65=2/5 10
49/98=4/8 10
1B/B6=1/6 12
2B/B8=2/8 12
3B/B9=3/9 12
5B/BA=5/A 12
1D/D7=1/7 14
6D/DC=6/C 14
17/75=1/5 15
27/76=2/6 15
2C/C9=2/9 15
2E/EA=2/A 15
3C/CA=3/A 15
4E/EC=4/C 15
15/54=1/4 16
19/96=1/6 16
1F/F8=1/8 16
2A/A8=2/8 16
39/98=3/8 16
3F/FC=3/C 16
7F/FE=7/E 16
1H/H9=1/9 18
2H/HC=2/C 18
5H/HF=5/F 18
8H/HG=8/G 18
1J/JA=1/A 20
3J/JF=3/F 20
4J/JG=4/G 20
9J/JI=9/I 20
The revised program:
DECLARE FUNCTION alp$ (x!)
CLS
OPEN "cancfall.txt" FOR OUTPUT AS #2
FOR b = 2 TO 20
FOR a1 = 1 TO b - 1
FOR a2 = 1 TO b - 1
FOR b1 = 1 TO b - 1
FOR b2 = 1 TO b - 1
IF a1 <> a2 OR b1 <> b2 THEN
IF a1 <> b1 OR a2 <> b2 THEN
num = b * a1 + a2: den = b * b1 + b2
IF den >= num THEN
IF a2 * den = b1 * num AND a1 = b2 THEN
PRINT alp$(a1); alp$(a2); "/"; alp$(b1); alp$(b2); "="; alp$(a2); "/"; alp$(b1); TAB(12); b
PRINT #2, alp$(a1); alp$(a2); "/"; alp$(b1); alp$(b2); "="; alp$(a2); "/"; alp$(b1); TAB(12); b
DO: LOOP UNTIL INKEY$ > ""
END IF
IF a1 * den = b2 * num AND a2 = b1 THEN
PRINT alp$(a1); alp$(a2); "/"; alp$(b1); alp$(b2); "="; alp$(a1); "/"; alp$(b2); TAB(12); b
PRINT #2, alp$(a1); alp$(a2); "/"; alp$(b1); alp$(b2); "="; alp$(a1); "/"; alp$(b2); TAB(12); b
END IF
END IF
END IF
END IF
NEXT
NEXT
NEXT
NEXT
NEXT b
CLOSE
END
FUNCTION alp$ (x)
alp$ = MID$("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", x + 1, 1)
END FUNCTION
|
Posted by Charlie
on 2013-01-18 20:51:57 |