def gen_apformula(AP, intrep):
    """Generate conjunction formula

    >>> gen_apformula(AP=("p", "q"), intrep=2)
    '!p & q'
    """
    return " & ".join([AP[i] if ((intrep >> i) & 1) != 0 else "!"+AP[i] for i in range(len(AP))])