Call A1A2 y, a two-digit number, and call the rest of the numerator x.
17(y*10^k + x) = 12(100x + y), where k = n-2
17y*10^k + 17x = 1200x + 12y
(17*10^k - 12)y = 1183x
x = (17*10^k - 12)y / 1183
The following program uses this equation to demonstrate that 6 is the smallest value of n that allows a solution:
4 kill "shiftdg2.txt":open "shiftdg2.txt" for output as #2
5 point 255
10 for n=3 to 100:k=n-2
20 for y=10 to 99
30 x = (17*10^k - 12)*y // 1183
40 if x=int(x) and (x>0 or y>0) then
41 :print n,y,x:ct=ct+1
42 :print #2, n,y,x:ct=ct+1
43 :numf=y*10^k+x:denf=100*x+y
44 :print #2,numf,denf,numf//denf
45 :print numf,denf,numf//denf
49 :if ct>10 then cancel for:goto 55
50 next y
55 if ct>10 then cancel for:goto 70
60 next n
65 close #2
70 end
The manually enhanced output below shows n, y and x on the first line. Division and equal signs have been added manually to show the resulting division equality
6 13 1868
131868 / 186813 = 12/17
6 26 3736
263736 / 373626 = 12/17
6 39 5604
395604 / 560439 = 12/17
6 52 7472
527472 / 747252 = 12/17
6 65 9340
659340 / 934065 = 12/17
plus the spurious line of output where a "carry" interferes with the digits, as x becomes larger than four digits:
6 78 11208
791208 / 1120878 12//17
|
Posted by Charlie
on 2019-03-13 13:30:43 |