Solution: Find the Egyptian Fraction

This review provides a detailed analysis of how to convert a fraction to a series of Egyptian Fractions

We'll cover the following

Solution

We can generate Egyptian Fractions using Greedy Algorithm. For a given number of the form n/d, where d > n, first find the greatest possible unit fraction, then perform recursion for the remaining part.

For example, consider 6/146/14. We first find the ceiling of 14/6\lceil 14/6 \rceil, i.e., 33, so the first unit fraction becomes 1/31/3. Now subtract 1/31/3 out of 6/146/14 and, then recur for (6/14(6/14 1/3)1/3) i.e., 4/424/42.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.