Numpy.gcd using more than 2 arrays

From https://numpy.org/doc/stable/reference/generated/numpy.gcd.html

The function signature is this:

def numpy.gcd(x1, x2, /, out=None, *, ...):

If you call gcd with three arguments, you are basically doing z = gcd(x, y). Therefore you need to come up with your own function. It could be something like

def my_gcd(x, y, z):
    return np.gcd(np.gcd(x, y), z)

which would return

[[1 1 1]
 [1 1 3]]