First collision point of two series | Function to calculate the colliding point of two series ; Iterating through n terms of the first series ; x is i - th term of first series ; d is first element of second series and c is common difference for second series . ; If no term of first series is found ; Driver code
def point ( a , b , c , d , n ) : NEW_LINE INDENT for i in range ( n ) : NEW_LINE INDENT x = b + i * a NEW_LINE if ( x - d ) % c == 0 and x - d >= 0 : NEW_LINE INDENT print x NEW_LINE return NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT print " No ▁ collision ▁ point " NEW_LINE DEDENT DEDENT a = 20 NEW_LINE b = 2 NEW_LINE c = 9 NEW_LINE d = 19 NEW_LINE n = 20 NEW_LINE point ( a , b , c , d , n ) NEW_LINE