I was just thinking of a problem which does not seem to be much hard but when we think of doing it optimally, it becomes quite a good problem. The problem is- We have been g
One obvious optimization is the following - do sieve of eratosthenes to fatorize all numbers up to a value you know is higher then any single one in the list you are given. Now you can iterate over all the factors of a given number from that list.
What you do next is: for each number from the list and each of its prime factors p you should divide N by p until it is divisible by it. After you do that the divisors you are looking for are all divisors of the remaining number.
Hope this helps.