In this alphametic equation, each of the capital letters in bold denotes a different base ten digit from 0 to 9, and x is any positive integer ≤ 16. None of R and T can be zero.
REKNIT 9*x
---------- = -----------
TINKER 9*x + 1
Determine the minimum value of REKNIT and maximum value of TINKER.
I concur with Daniel's solution but we have approached the programming differently, and I have used QuickBasic and one of Charlie's 'formats'; and I have indicated the 'x' values.
TINKER REKNIT x Ratio of RHS 208791 197802 2 .9473684
Min REKNIT 307692 296703 3 .9642857
406593 395604 4 .972973
604395 593406 6 .9818182
703296 692307 7 .984375
802197 791208 8 .9863014
Max REKNITCLS
OPEN "tinker.txt" FOR OUTPUT AS #1
DIM SHARED used(10)
FOR r = 1 TO 9
IF used(r) = 0 THEN
used(r) = 1
FOR e = 0 TO 9
IF used(e) = 0 THEN
used(e) = 1
FOR k = 0 TO 9
IF used(k) = 0 THEN
used(k) = 1
FOR n = 0 TO 9
IF used(n) = 0 THEN
used(n) = 1
FOR i = 0 TO 9
IF used(i) = 0 THEN
used(i) = 1
FOR t = r + 1 TO 9
IF used(t) = 0 THEN
used(t) = 1
tinker = 10 ^ 5 * t + 10 ^ 4 * i + 10 ^ 3 * n + 10 ^ 2 * k + 10 * e + r
reknit = 10 ^ 5 * r + 10 ^ 4 * e + 10 ^ 3 * k + 10 ^ 2 * n + 10 * i + t
rat1 = reknit / tinker
FOR x = 1 TO 16
rat2 = (9 * x) / (9 * x + 1)
IF rat1 = rat2 THEN
PRINT #1, tinker; reknit; x; rat1; rat2
PRINT tinker; reknit; x; rat1; rat2
END IF
NEXT x
used(t) = 0
END IF
NEXT t
used(i) = 0
END IF
NEXT i
used(n) = 0
END IF
NEXT n
used(k) = 0
END IF
NEXT k
used(e) = 0
END IF
NEXT e
used(r) = 0
END IF
NEXT r
CLOSE 1
|
Posted by brianjn
on 2009-10-05 03:52:38 |