In [1]:
import sympy as sym
import numpy as np
import math

from IPython.display import display, Math
from sympy.abc import w,x,y,z,a,b,c,d
sym.init_printing()
In [2]:
import math

math.gcd(4,16)
Out[2]:
$$4$$
In [3]:
math.gcd(95,100)
Out[3]:
$$5$$
In [4]:
# application

a = 16
b = 88

fact = math.gcd(a,b)

display(Math('\\frac{%g}{%g} = \\frac{%g\\times %g}{%g\\times %g}' %(a,b,a/fact,fact,b/fact,fact)))
$\displaystyle \frac{16}{88} = \frac{2\times 8}{11\times 8}$