Call A1 y, a single-digit number, and call the rest of the numerator (A2 ... A(n-1)) x.
17(y*10^k + x) = 12(10x + y), where k = n-1
This can be evaluated to
x = y(17*10^k - 12) / 103
UBASIC allows us the precision to solve this:
(n in the program is the k used above)
4 kill "shiftdig.txt":open "shiftdig.txt" for output as #2
5 point 255
10 for n=2 to 100
20 for y=0 to 9
30 x = y*(17*10^n-12)//103
40 if x=int(x) and (x>0 or y>0) then
41 :print n+1,y,x:ct=ct+1
42 :print #2, n+1,y,x:ct=ct+1
43 :numf=y*10^n+x:denf=10*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
70 end
With n=34, which is the smallest value for n:
1165048543689320388349514563106796 / 1650485436893203883495145631067961 = 12/17
2330097087378640776699029126213592 / 3300970873786407766990291262135922 = 12/17
3495145631067961165048543689320388 / 4951456310679611650485436893203883 = 12/17
4660194174757281553398058252427184 / 6601941747572815533980582524271844 = 12/17
5825242718446601941747572815533980 / 8252427184466019417475728155339805 = 12/17
6990291262135922330097087378640776 / 9902912621359223300970873786407766 = 12/17
The raw output:
34 1 165048543689320388349514563106796
1165048543689320388349514563106796 1650485436893203883495145631067961 12//17
34 2 330097087378640776699029126213592
2330097087378640776699029126213592 3300970873786407766990291262135922 12//17
34 3 495145631067961165048543689320388
3495145631067961165048543689320388 4951456310679611650485436893203883 12//17
34 4 660194174757281553398058252427184
4660194174757281553398058252427184 6601941747572815533980582524271844 12//17
34 5 825242718446601941747572815533980
5825242718446601941747572815533980 8252427184466019417475728155339805 12//17
34 6 990291262135922330097087378640776
6990291262135922330097087378640776 9902912621359223300970873786407766 12//17
|
Posted by Charlie
on 2019-03-11 17:42:32 |