[Solved]Python Implement Function Egypt Numerator Denominator Uses Greedy Strategy Determine Set D Q37023982
In python, implement function egypt(numerator, denominator) thatuses the greedy strategy to determine a set of distinct (i.e. alldifferent) Egyptian fractions that sum to numerator/denominator.You may assume numerator and denominator are positive integers andthat numerator is less than or equal to denominator. Your functionshould both 1) print a readable “equation” showing theresult (see examples below and 2) return a list of Egyptianfraction denominators
Examples:>>> egypt(4,5)4/5 = 1/2 + 1/4 + 1/20[2, 4, 20]>>> egypt(2,11)2/11 = 1/6 + 1/66[6, 66]>>> egypt(761, 1000)761/1000 = 1/2 + 1/4 + 1/91 + 1/91000[2, 4, 91, 91000]
Important note: do not use division in your function.All calculations should be done with integers. In particular, thedifference (n/d) – (1/c) of slide 9 is a key step. You cancalculate an integer numerator and integer denominator of thisdifference using only multiplication and subtraction.
Expert Answer
Answer to In python, implement function egypt(numerator, denominator) that uses the greedy strategy to determine a set of distinct… . . .
OR

