Find the Nth natural number which is not divisible by A | Python3 code to Find the Nth number which is not divisible by A from the series ; Find the quotient and the remainder when k is divided by n - 1 ; if remainder is 0 then multiply n by q and add the remainder ; print the answer ; driver code
def findNum ( n , k ) : NEW_LINE INDENT q = k // ( n - 1 ) NEW_LINE r = k % ( n - 1 ) NEW_LINE if ( r != 0 ) : NEW_LINE INDENT a = ( n * q ) + r NEW_LINE DEDENT else : NEW_LINE INDENT a = ( n * q ) - 1 NEW_LINE DEDENT print ( a ) NEW_LINE DEDENT A = 4 NEW_LINE N = 6 NEW_LINE findNum ( A , N ) NEW_LINE