(a, b, z)
return z
Reconstruct the `z` value of an equivalent solution of `ax^2 + by^2 + cz^2`
    from the `z` value of a solution of a transformed version of the above
    equation.
Reconstruct the `z` value of an equivalent solution of `ax^2 + by^2 + cz^2`
    from the `z` value of a solution of a transformed version of the above
    equation.
Reconstruct the z value of an equivalent solution of ax^2 + by^2 + cz^2 from the z value of a solution of a transformed version of the above equation .
def reconstruct(a, b, z):
    """
    Reconstruct the `z` value of an equivalent solution of `ax^2 + by^2 + cz^2`
    from the `z` value of a solution of a transformed version of the above
    equation.
    """
    g = igcd(a, b)

    if g != 1:
        f = factorint(g)
        for p, e in f.items():
            if e %2 == 0:
                z = z*p**(e//2)
            else:
                z = z*p**((e//2)+1)

    return z
def reconstruct ( a , b , z ) : g = igcd ( a , b ) if g != 1 : f = factorint ( g ) for p , e in f . items ( ) : if e % 2 == 0 : z = z * p ** ( e // 2 ) else : z = z * p ** ( ( e // 2 ) + 1 ) return z