You run through some integers to check them against the arrays, whether they match the expecations as the two given. When they do, these integers become the answer.

So lets say we are investigating integer X. The integer X has to be

--> Perfectly divisible by all elements in the first array. If you divide X by any integer from the array, you would need to get a full number. This by definition means that the elements of such array would be factors of X. Such condition can be checked by the MOD function, which returns the remainder of division, where X % Array1Element = 0

--> Perfectly divide into all elements in the second array. Each element divided by X would produce an integer result. Such that Array2Element % X = 0