Lionel has a calculator that displays a maximum of ten digits (for example: 3,478,062,139 and 0.073672932)
• Lionel chose 4 distinct prime numbers p,q,r and s all less than 100 and he calculates p/q – r/s. The result is 0.180451127. Determine p,q,r and s.
• Consider the two base ten numbers 0.728101457 and 0.635149023. One of these numbers is the result displayed by Lionel's calculator of an irreducible fraction u/v with u and v, that are positive integers less than 1000. The decimals of the other number are taken from a table of random numbers.
Determine the terms u and v of the irreducible fraction.
The calculator appears to compute the final digit it can display by truncation rather than by rounding.
Three solutions for Part One.
And for Part Two, it is the second result that is u/v:
u = 618
v = 973
Part One
17/19 - 5/7 = 0.18045112781954886
23/7 - 59/19 = 0.18045112781954886
37/7 - 97/19 = 0.18045112781954842
Part Two
399/548 = 0.7281021897810219 not a match
618/973 = 0.6351490236382322
print('Part One')
for perm in permutations(primes,4):
if abs((perm[0]/perm[1] - perm[2]/perm[3]) - 0.180451127) < .000001:
print( '{}/{} - {}/{} = '.format(perm[0],perm[1],perm[2],perm[3]),
(perm[0]/perm[1] - perm[2]/perm[3]) )
print('\nPart Two')
values = [i for i in range(1,1001)]
for perm in permutations(values,2):
if abs((perm[0]/perm[1]) - 0.728101457) < .000001:
print( '{}/{} = '.format(perm[0],perm[1]),
(perm[0]/perm[1]) )
if abs((perm[0]/perm[1]) - 0.635149023) < .000001:
print( '{}/{} = '.format(perm[0],perm[1]),
(perm[0]/perm[1]) )
|
Posted by Larry
on 2023-03-02 14:34:15 |