Macaulay2 » Documentation
Packages » Python » PythonObject » gcd(PythonObject,PythonObject)
next | previous | forward | backward | up | index | toc

gcd(PythonObject,PythonObject) -- greatest common divisor of Python objects

Description

This computes the greatest common divisor of two Python objects.

i1 : gcd(toPython 12, toPython 15)

o1 = 3

o1 : PythonObject of class int

If one of the arguments is a Macaulay2 object, then it is first converted to a Python object.

i2 : gcd(toPython 12, 15)

o2 = 3

o2 : PythonObject of class int
i3 : gcd(12, toPython 15)

o3 = 3

o3 : PythonObject of class int

Since gcd is a binary method, it will accept any number of arguments.

i4 : gcd toPython 5

o4 = 5

o4 : PythonObject of class int
i5 : gcd (toPython 7, toPython 14, 28)

o5 = 7

o5 : PythonObject of class int

See also

Ways to use this method:


The source of this document is in Python/doc/number-theory.m2:88:0.