Javascript program to print nearest element with at least one common prime factor .
let MAX = 100001 ; let INF = Number . MAX_VALUE ; let primedivisor = new Array ( MAX ) ; let dist = new Array ( MAX ) ; let pos = new Array ( MAX ) ; let divInd = new Array ( MAX ) ; for ( let i = 0 ; i < MAX ; i ++ ) { primedivisor [ i ] = 0 ; dist [ i ] = 0 ; pos [ i ] = 0 ; divInd [ i ] = 0 ; } let divisors = [ ] ;