Balanced Function Deutsch-Jozsa Algorithm

bd4970eb-8515-415e-9ba0-25bcdccecda2
4.0
Description

This circuit implements the Deutsch-Jozsa algorithm for a balanced function and measures the first three qubits of a four-qubit system.

Qiskit Circuit Code
Python
```python
from qiskit import QuantumCircuit

# Create circuit with 4 qubits and 3 classical bits
qc = QuantumCircuit(4, 3)

# Initialize the last qubit to |1>
qc.x(3)

# Apply Hadamard gates to all qubits
qc.h([0, 1, 2, 3])

# Oracle for a balanced function (example for Deutsch-Jozsa algorithm)
qc.cx(0, 3)
qc.cx(1, 3)
qc.cx(2, 3)

# Apply Hadamard gates to the first three qubits
qc.h([0, 1, 2])

# Measure the first three qubits
qc.measure([0, 1, 2], [0, 1, 2])
```
Quantum Execution Results
ibm_kyiv
unknown
1024 shots
Measurement Counts
{
  "000": 8,
  "001": 4,
  "010": 4,
  "011": 16,
  "101": 20,
  "110": 45,
  "111": 927
}
Raw Result Data
Download Results
Back to Home