human
Split the fraction into sum of multiple fractions having numerator as 1 | Function to split the fraction into distinct unit fraction.
To store answer.
While numerator is positive.
Finding x = ceil ( d / n ).
Add 1 / x to list of ans.
Update fraction.
Given Input.
Function Call.
Print Answer"
How can the above be solved in Python?
 ... Give me a code to split the fraction into sum of multiple fractions having numerator as 1 and the other steps required?
assistant
#Here is code to split the fraction into sum of multiple fractions having numerator as 1 and the other steps required.
 def FractionSplit ( n , d ) :
	UnitFactions = [ ]
	while ( n > 0 ) :
		x = ( d + n - 1 ) // n
		s = "1 / " + str ( x )
		UnitFactions . append ( s ) ;
		n = n * x - d ;
		d = d * x
	return UnitFactions ;
n = 13 ;
d = 18 ;
res = FractionSplit ( n , d ) ;
for s in res :
	print ( s + " , ▁ " , end = " ▁ " ) ;