# SymPy | Partition.RGS_enum() in Python

Partition.RGS_enum() : RGS_enum() is a sympy Python library function that calculates the total number of restricted growth strings (string where a[i] is the block in which element i occurs) which is possible for a superset of size n.

Restricted growth strings – string in which each character, ai results in the Block (Bi) in which the corresponding element belongs.

Syntax : sympy.combinatorics.partitions.Partition.RGS_enum()

Return : total number of restricted growth strings, possible for a superset of size n.

Code #1 : RGS_enum() Example

 `# Python code explaining ` `# SymPy.RGS_enum() ` ` `  `# importing SymPy libraries ` `from` `sympy.combinatorics.partitions ``import` `Partition ` `from` `sympy.combinatorics.partitions ``import` `RGS_enum ` ` `  `# Using from sympy.combinatorics.partitions.Partition.RGS_enum() method  ` `p ``=` `RGS_enum(``4``) ` ` `  `q ``=` `RGS_enum(``9``) ` ` `  `print` `(``"no. of strings possible for size  4: "``, p) ` `print` `(``"no. of strings possible for size  9: "``, q) `

Output :

no. of strings possible for size 4: 15
no. of strings possible for size 9: 203

Code #2 : RGS_enum() Example

 `# Python code explaining ` `# SymPy.RGS_enum() ` ` `  `# importing SymPy libraries ` `from` `sympy.combinatorics.partitions ``import` `Partition ` `from` `sympy.combinatorics.partitions ``import` `RGS_enum ` ` `  `# Using from sympy.combinatorics.partitions.Partition.RGS_enum() method  ` `p ``=` `RGS_enum(``20``) ` ` `  `q ``=` `RGS_enum(``-``1``) ` ` `  `print` `(``"no. of strings possible for size  20 "``, p) ` `print` `(``"no. of strings possible for size  -1: "``, q) `

Output :

no. of strings possible for size 20 51724158235372
no. of strings possible for size -1: 0

My Personal Notes arrow_drop_up Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.