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.
I found three sets of primes for {p,q,r,s} which find the correct result, if the calculator determines the last displayed digit by truncation rather than by rounding:
17/19 - 5/7 = 0.18045112781954886
23/7 - 59/19 = 0.18045112781954886
37/7 - 97/19 = 0.18045112781954842
-----
primes = [p for p in range(2,100) if isprime(p)]
from itertools import permutations
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]) )
Edited on March 2, 2023, 2:25 pm
|
Posted by Larry
on 2023-03-02 14:19:05 |