Function to express K as sum of several N_bonacci numbers
def N_bonacci_nums ( n , k ) : NEW_LINE INDENT N_bonacci [ 0 ] = 1 NEW_LINE for i in range ( 1 , 51 ) : NEW_LINE INDENT j = i - 1 NEW_LINE while j >= i - k and j >= 0 : NEW_LINE INDENT N_bonacci [ i ] += N_bonacci [ j ] NEW_LINE j -= 1 NEW_LINE DEDENT DEDENT ans = [ ] NEW_LINE for i in range ( 50 , - 1 , - 1 ) : NEW_LINE INDENT if ( n - N_bonacci [ i ] >= 0 ) : NEW_LINE INDENT ans . append ( N_bonacci [ i ] ) NEW_LINE n -= N_bonacci [ i ] NEW_LINE DEDENT DEDENT if ( len ( ans ) == 1 ) : NEW_LINE INDENT ans . append ( 0 ) NEW_LINE DEDENT print ( len ( ans ) ) NEW_LINE for i in ans : NEW_LINE INDENT print ( i , end = " , ▁ " ) NEW_LINE DEDENT DEDENT