Classical against quantum query counts: reading the scaling table

How many oracle calls each problem needs as n grows, with the exact formulas used by the lab and the one place where an estimate replaces an exact count.

8 min read · reviewed December 2026

The three counts

Deutsch–Jozsa classical cost is 2^(n−1) + 1 for a guaranteed answer. Bernstein–Vazirani classical cost is n queries when the offset is known and n + 1 when it is not. Simon classical cost grows like 2^(n/2). The quantum costs are 1, 1 and about n − 1 plus a small constant respectively.

Oracle calls needed. Simon’s classical column is an order of growth, not an exact count.
nDJ classical (guaranteed)BV classical (b = 0)Simon classical (about 2^(n/2))Simon quantum (expected runs)
49444.48
81298168.60
1632,7691625616.61
248,388,609244,09624.61
322,147,483,6493265,53632.61

Exact versus estimated

  • Deutsch–Jozsa classical: exact worst case. A balanced function can hide behind 2^(n−1) equal answers.
  • Bernstein–Vazirani classical: exact lower bound of n, since each answer is one bit and the secret has n bits.
  • Simon classical: an order of growth, not an exact count. The lab shows a union-bound estimate: k queries make k(k−1)/2 pairs, each equal to s with chance 1/(2^n − 1), so the chance of a hit is at most that ratio. This page’s own arithmetic.
  • Simon quantum: an exact expected value of runs under the uniform model, from the sum in the Simon guide.

Reading growth, not size

At n = 32 the Deutsch–Jozsa classical count is over two billion queries and the quantum count is one. That makes a dramatic table, but remember that the model charges nothing for the oracle. A 32-bit oracle that must also be run in superposition is a circuit with its own cost.

The gap that matters most for the history of the subject is Simon’s. It is exponential, it holds against any classical algorithm that errs with small probability, and its mechanism generalised. The Deutsch–Jozsa gap is exponential only against deterministic classical algorithms, as the next guide explains.

Using the slider

In the lab’s Query counts tab, drag n from 2 to 40. The Deutsch–Jozsa row doubles with each step. The Bernstein–Vazirani row climbs by one. The Simon row grows by a factor of about 1.41 per step, the square root of two. Those three growth rates, exponential, linear and square-root-of-exponential, are the real content of the table.

Try it

Questions

Why is Simon’s classical cost not exact?

It depends on the search strategy and on the function. The 2^(n/2) figure is the standard order of growth for random search, not an exact formula.

Are these counts the speed-up of a real computer?

No. They count oracle calls only. Real speed-ups depend on the cost of building and running the oracle and on the hardware.

Read next

Sources and further reading

Check the original sources for exact citations.