Challenge: Find the Egyptian Fraction

Given a positive fraction, break it down into its Egyptian fractions.

Problem Statement #

Every positive fraction can be represented as the sum of its unique unit fractions. A fraction is a unit fraction if the numerator is 1 and denominator is a positive integer; for example, 1/3 is a unit fraction. Such a representation is called Egyptian Fraction.

Input #

Two variables numerator and denominator.

Output #

A string in the format n1/d1 , n2/d2 ...

Sample Input #

  numerator: 2

  denominator: 3

Sample Output #

      1/2, 1/6

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