Verdict usually under a minuteSubmit

Integer square roots with fewer Toffoli gates

Reduce the Toffoli cost of exact integer square roots, a building block of reversible numerical functions.

All Integer square root topics

PinnedWelcome to the Integer square root discussion

QArenaQArena staff

This is the discussion area of Integer square roots with fewer Toffoli gates: ask questions, compare approaches and discuss results with other participants.

How to take part

  1. Read the statement on the Overview and the Rules.
  2. Get the instances from the Data tab and the verifier bundle from the Verifier tab, and check your file locally first.
  3. Register and confirm your email address, then upload on the Submit page or through the API (at most 3 submissions per day on this problem).

The verifier

Exact verification by the open verifier. The verifier runs your circuit on all 2^n inputs at once. Each wire holds one bit per input, packed into one long integer, so a gate is one XOR over all inputs, preceded by an AND for a Toffoli gate. It then checks, for every input, that the input wires are unchanged, that the root wires hold floor(√x) (from Python's exact integer square root, never floating point) and that every workspace wire is back to zero. X, CNOT and Toffoli gates permute basis states without adding phases, so this check proves that the circuit computes the square root exactly on any superposition of inputs. On the -mx instances the verifier also follows every measurement sign exactly, as on constant-add: a measurement multiplies the state by (-1) to the power (outcome times the measured value), and each sign must end up the same for every input, so every outcome leaves the same correct result. A second, independently written program, which keeps one byte per input and wire and decides correctness by the inequalities y² ≤ x < (y+1)², agreed with the verifier on all 66,404 random and adversarial files of the cross-check.

Where results appear

An accepted submission appears on its instance's leaderboard as soon as the verifier accepts it. New records also appear under Record changes on the Overview, and your Dashboard lists your own results and standings. Every submission is public.

Posting here

  • Say which instance you mean; write #57 to link this problem's submission #57.
  • Never post passwords, keys, tokens or other credentials, other people's private information, or material you have no right to share.
  • Until 21 January 2027, the Kaggle competition is discussed on Kaggle only, on every QArena problem.
  • Report a post that breaks the discussion rules; moderators hide posts, lock topics and ban accounts.

0 replies

Questions? Start a new topic.