#NEWLINE# @ annotate #NEWLINE# def decimal_to_factoradic( decimal ) : #NEWLINE# #INDENT# def _print( cq , p , q , r ) : #NEWLINE# #INDENT# print ( '{} / {} = {} r{}' . format ( cq , p , q , r ) ) #NEWLINE# #UNINDENT# 'Converts a decimal number to factoradic form.\n\n    Args:\n        decimal (int) - the decimal number to convert\n    Returns:\n        res (int) - the decimal number that has been converted\n\n    >>> decimal_to_factoradic(463)\n    >>> 341010\n    ' #NEWLINE# ( digits , position ) = ( '' , 1 ) #NEWLINE# ( quotient , rem ) = divmod ( decimal , position ) #NEWLINE# prev_quotient = quotient #NEWLINE# _print ( prev_quotient , position , quotient , rem ) #NEWLINE# while ( quotient != 0 ) : #NEWLINE# #INDENT# digits += str ( rem ) #NEWLINE# position += 1 #NEWLINE# prev_quotient = quotient #NEWLINE# ( quotient , rem ) = divmod ( quotient , position ) #NEWLINE# _print ( prev_quotient , position , quotient , rem ) #NEWLINE# #UNINDENT# digits += str ( rem ) #NEWLINE# digits = digits [ : : ( - 1 ) ] #NEWLINE# print_simple ( 'dec2fac result' , digits ) #NEWLINE# return int ( digits )