def METHOD_NAME(nqubits, dense=True, backend=None):
    """Max Cut Hamiltonian.
    .. math::
        H = - \\sum _{i,j=0}^N  \\frac{1 - Z_i Z_j}{2}.
    Args:
        nqubits (int): number of quantum bits.
        dense (bool): If ``True`` it creates the Hamiltonian as a
            :class:`qibo.core.hamiltonians.Hamiltonian`, otherwise it creates
            a :class:`qibo.core.hamiltonians.SymbolicHamiltonian`.
    """
    import sympy as sp
    from numpy import ones
    Z = sp.symbols(f"Z:{nqubits}")
    V = sp.symbols(f"V:{nqubits**2}")
    sham = -sum(
        V[i * nqubits + j] * (1 - Z[i] * Z[j])
        for i in range(nqubits)
        for j in range(nqubits)
    )
    sham /= 2
    v = ones(nqubits**2)
    smap = {s: (i, matrices.Z) for i, s in enumerate(Z)}
    smap.update({s: (i, v[i]) for i, s in enumerate(V)})
    ham = SymbolicHamiltonian(sham, symbol_map=smap, backend=backend)
    if dense:
        return ham.dense
    return ham