human
Generation of n numbers with given set of factors | Generate n numbers with factors in factor [ ].
array of k to store next multiples of given factors.
Prints n numbers output = 0.
Next number to print as output.
Find the next smallest multiple.
Printing minimum in each iteration print the value if output is not equal to current value ( to avoid the duplicates ).
incrementing the current value by the respective factor.
Driver code"
How can the above be solved in Python?
 Give me a code to generation of n numbers with given set of factors and the other steps required?
assistant
#Here is code to generation of n numbers with given set of factors and the other steps required.
 def generateNumbers ( factor , n , k ) :
	next = [ 0 ] * k ;
	i = 0 ;
	while ( i < n ) :
		toincrement = 0 ;
		for j in range ( k ) :
			if ( next [ j ] < next [ toincrement ] ) :
				toincrement = j ;
		if ( output != next [ toincrement ] ) :
			output = next [ toincrement ] ;
			print ( next [ toincrement ] , end = " ▁ " ) ;
			i += 1 ;
		next [ toincrement ] += factor [ toincrement ] ;
factor = [ 3 , 5 , 7 ] ;
n = 10 ;
k = len ( factor ) ;
generateNumbers ( factor , n , k ) ;