For numbers from 1 to r find arr [ j ] such that gcd ( i , arr [ j ] ) > 1
for ( var k = 1 ; k < r + 1 ; k ++ ) { var j = 0 , i = k ; while ( j < arr . length ) { var x = gcd ( i , arr [ j ] ) ; if ( x > 1 ) {