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

# lcm(PythonObject,PythonObject) -- least common multiple of Python objects

- Function: lcm
- Usage:
    `lcm(x, y)`
- Inputs:
  - x, a python object,
  - y, a python object,
- Outputs:
  - a python object, the least common multiple of x and y;

## Description

This computes the least common multiple of two Python objects.

    i1 : lcm(toPython 12, toPython 15)

    o1 = 60

    o1 : PythonObject of class int

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

    i2 : lcm(toPython 12, 15)

    o2 = 60

    o2 : PythonObject of class int

    i3 : lcm(12, toPython 15)

    o3 = 60

    o3 : PythonObject of class int

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

    i4 : lcm toPython 5

    o4 = 5

    o4 : PythonObject of class int

    i5 : lcm (toPython 7, toPython 14, 28)

    o5 = 28

    o5 : PythonObject of class int

## See also

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

## Ways to use this method:

- `lcm(PythonObject)`
- lcm(PythonObject,PythonObject) -- least common multiple of Python objects
- `lcm(PythonObject,Thing)`
- `lcm(Thing,PythonObject)`

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Python/doc/number-theory.m2:124:0.