C ++ program to print nearest element with at least one common prime factor .
#include <bits/stdc++.h> NEW_LINE using namespace std ; const int MAX = 100001 ; const int INF = INT_MAX ; int primedivisor [ MAX ] , dist [ MAX ] , pos [ MAX ] , divInd [ MAX ] ; vector < int > divisors [ MAX ] ;