pygsti.tools.listtools.partitions

Contents

pygsti.tools.listtools.partitions#

partitions(n)#

Iterate over all partitions of integer n.

A partition of n here is defined as a list of one or more non-zero integers which sum to n. Every partition is iterated over exactly once - there are no duplicates/repetitions.

Parameters:

n (int) – The number to partition.