Iterating through all the prime numbers and check if any of the prime numbers is a factor of the given input array
for ( int i : allPrimes ) { for ( int j : arr ) { if ( j % i == 0 ) { list1 . push_back ( i ) ; break ; } } } return list1 ; }