Greatest common factor

Hello, Does anyone know if there is an easy way to grab the greatest common factor between 2 lists of integers?
I can get the greatest common denominator pretty easily but the greatest common factor is giving me a problem.

For example if I have 2 lists:

  1. 5, 3, 6, 7
  2. 8, 3, 4, 7

The result should = 7

Thank you!

Anyone? I need greatest common factor for something similar to this below, help please:

$val1 = [5,3,6,7] 
$val2 = [8,3,4,7]

print gcd($val1, $val2)

@rmazin
Can you please explain how the answer came out to be 7.
I do not understand how gcd is to be calculated for two lists.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.