Divide N into K parts in the form ( X , 2 X , ... , KX ) for some value of X | Function to find the division ; Calculating value of x1 ; Print - 1 if division is not possible ; Get the first number ie x1 then successively multiply it by x1 k times by index number to get the required answer ; Given N and K ; Function Call
def solve ( n , k ) : NEW_LINE INDENT d = k * ( k + 1 ) ; NEW_LINE if ( ( 2 * n ) % d != 0 ) : NEW_LINE INDENT print ( " - 1" ) ; NEW_LINE return ; NEW_LINE DEDENT x1 = 2 * n // d ; NEW_LINE for i in range ( 1 , k + 1 ) : NEW_LINE INDENT print ( x1 * i , end = " ▁ " ) ; NEW_LINE DEDENT DEDENT n = 10 ; k = 4 ; NEW_LINE solve ( n , k ) ; NEW_LINE