human
Write me a code to divide N into K parts in the form ( X , 2 X , given the following:
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"
How can the above be solved in Python?
assistant
#Here is code to divide N into K parts in the form ( X , 2 X , .
 def solve ( n , k ) :
	d = k * ( k + 1 ) ;
	if ( ( 2 * n ) % d != 0 ) :
		print ( " - 1" ) ;
		return ;
	x1 = 2 * n // d ;
	for i in range ( 1 , k + 1 ) :
		print ( x1 * i , end = " ▁ " ) ;
n = 10 ; k = 4 ;
solve ( n , k ) ;