Entanglement

Logarithmic-Depth GHZ

Difficulty: Medium ★★

A CX ladder builds GHZ in linear depth, and decoherence punishes every layer. Grow the cat state like a binary tree instead: every entangled qubit recruits a new one in each round.

Objective

prepare_ghz_fast(num_qubits) returns a circuit preparing (|0...0> + |1...1>)/sqrt(2) with depth at most 1 + ceil(log2(num_qubits)).

Constraints

  • Allowed gates: h, cx.

Entry Point

prepare_ghz_fast

Checks

  • Exports prepare_ghz_fast(num_qubits).
  • Prepares GHZ for 1 to 9 qubits within the depth limit.

Your Code

Outputpending

Execution results will appear here.