Here is an answer that should work. I do not currently have access to matlab to check this for anything other than the smallest cases, so you should do that.

First off, I find it easier personally to work in the reduced set of $3^N-1$ stabilizers for N qubits (generating the other from those). Entirely a personal preference, and doesn't change the result here.

So we want to divide the $3^N-1$ possible stabilizers into sets of $2^N-2$ commuting stabilizers, and find how many such divisions are possible.

Define

$\alpha = 2^N-2$ = size of sets

$\beta = \frac{3^N-1}{2^N-2}$ = number of sets.

We now pick our sets from the available stabilizers. The first time, we can pick anything - $3^N-1$ choices. Then we have to pick a commuting set, which we'll come back to. After picking the set, there are $(3^N-1) - \alpha$ stabilizers remaining. We can pick any for the first of the next set. And so on. However, for the final set there is no choice: there will only be $\alpha$ stabilizers left. So the choices for the first entry of each set are

$F = \prod_{k=0}^{\beta-2}(3^N-1) - \alpha k$

Now to pick each set. On average, half the stabilizers remaining to chose from will commute with any given one. So picking the second one, half the remainder will do. So for the first set, we have $((3^N-1) - 1)/2$ choices. The next choice has to commute with *both* the previous ones, so we have $((3^N-1) - 2)/2^2$ choices. And so on. For the next set, we start with $(3^N-1) - (\alpha+1)$ remaining stabilizers to pick the second entry. So the choices for picking the sets are

$S = \prod_{m=1}^{\beta} \prod_{i=1}^{\alpha-1}( \frac{3^N - (\alpha m + 1) - i)}{2^{i+1}} ) $

So the number of possible partitions is $F.S$ divided by the number of possible ways to permute within the sets x number of sets (PR) and number of ways of permuting the sets themselves (PC):

$PR = \beta.\alpha !$

$PC = \beta !$

So the number of partitions is
$\frac{F.S}{PR.PC}$

This post has been migrated from (A51.SE)