Function to calculate all divisors of input array
def findDivisors ( arr , n ) : NEW_LINE INDENT for i in range ( MAX ) : NEW_LINE INDENT pos [ i ] = divInd [ i ] = - 1 NEW_LINE dist [ i ] = 10 ** 9 NEW_LINE DEDENT for i in range ( n ) : NEW_LINE INDENT num = arr [ i ] NEW_LINE while ( num > 1 ) : NEW_LINE INDENT div = primedivisor [ num ] NEW_LINE divisors [ i ] . append ( div ) NEW_LINE while ( num % div == 0 ) : NEW_LINE INDENT num //= div NEW_LINE DEDENT DEDENT DEDENT DEDENT def nearestGCD ( arr , n ) : NEW_LINE