def principal_form(disc):
    """Construct principal form for given discriminant.

    Follows Def. 5.4 from `Binary quadratic forms` by Lipa Long, 2019:
    https://github.com/Chia-Network/vdf-competition/blob/master/classgroups.pdf
    """
    assert disc % 4 == 0 or disc % 4 == 1
    k = disc % 2
    f = (1, k, (k ** 2 - disc) // 4)
    return f