Find Nth number in a sequence which is not a multiple of a given number | Python3 program for the above approach ; Function to find Nth number not a multiple of A in range [ L , R ] ; Calculate the Nth no ; Check for the edge case ;  ; Input parameters ; Function Call
import math NEW_LINE def countNo ( A , N , L , R ) : NEW_LINE INDENT ans = L - 1 + N + math . floor ( ( N - 1 ) / ( A - 1 ) ) NEW_LINE if ans % A == 0 : NEW_LINE INDENT ans = ans + 1 ; NEW_LINE DEDENT print ( ans ) NEW_LINE DEDENT / * Driver Code * / NEW_LINE A , N , L , R = 5 , 10 , 4 , 20 NEW_LINE countNo ( A , N , L , R ) NEW_LINE