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