human
N | Return the n - th number in the sorted list of multiples of two numbers ..
Generating first n multiple of a ..
Sorting the sequence ..
Generating and storing first n multiple of b and storing if not present in the sequence ..
If not present in the sequence.
Storing in the sequence ..
Driver Code"
Solution in Python:
assistant
#Here is code to n and the other steps required.
 def nthElement ( a , b , n ) :
	seq = [ ] ;
	for i in range ( 1 , n + 1 ) :
		seq . append ( a * i ) ;
	seq . sort ( ) ;
	i = 1 ;
	k = n ;
	while ( i <= n and k > 0 ) :
		try :
			z = seq . index ( b * i ) ;
		except ValueError :
			seq . append ( b * i ) ;
			seq . sort ( ) ;
			k -= 1 ;
		i += 1 ;
	return seq [ n - 1 ] ;
a = 3 ;
b = 5 ;
n = 5 ;
print ( nthElement ( a , b , n ) ) ;