I need some help in multi-qubit controlled -Z rotation. Below is the qiskit code of triple controlled z rotation
def cccZ():
qc = QuantumCircuit(4)
qc.cp(pi/4, 0, 3)
qc.cx(0, 1)
qc.cp(-pi/4, 1, 3)
qc.cx(0, 1)
qc.cp(pi/4, 1, 3)
qc.cx(1, 2)
qc.cp(-pi/4, 2, 3)
qc.cx(0, 2)
qc.cp(pi/4, 2, 3)
qc.cx(1, 2)
qc.cp(-pi/4, 2, 3)
qc.cx(0, 2)
qc.cp(pi/4, 2, 3)
gate = qc.to_gate(label=' cccZ')
return gate
Please help me in modifying this code to hexa qubit z rotation? It would be really great if someone can explain its theory also. I am really struggling with random nature of quantum computing with no fixed pattern at all.