def cardinality(self): """ EXAMPLES:: sage: from sage.combinat.restricted_growth import RestrictedGrowthArrays sage: R = RestrictedGrowthArrays(6) sage: R.cardinality() 203 """ return bell_number(self._n)
def _gs_iterator(self, base_ring): r""" EXAMPLES:: sage: P = species.PartitionSpecies() sage: g = P.generating_series() sage: g.coefficients(5) [1, 1, 1, 5/6, 5/8] """ from sage.combinat.combinat import bell_number for n in _integers_from(0): yield self._weight*base_ring(bell_number(n)/factorial_stream[n])
def cardinality(self): """ Return the number of set partitions of the set `S`. The cardinality is given by the `n`-th Bell number where `n` is the number of elements in the set `S`. EXAMPLES:: sage: SetPartitions([1,2,3,4]).cardinality() 15 sage: SetPartitions(3).cardinality() 5 sage: SetPartitions(3,2).cardinality() 3 sage: SetPartitions([]).cardinality() 1 """ return bell_number(len(self._set))