# Python | sympy.partition () method

|

` `

## section (n) —

Section numbers are a sequence of integers p n, which represent the number of different ways of representing n as a sum of natural numbers (with no important order). The generating function for p n is defined as — ,

Syntax: partition (n)

Parameter:
n - It denotes the number upto which partition number is to be calculated.

Returns: Returns the n th partition number.

Example # 1:

` `

` # import sympy from sympy import *     n = 7 print ( "Value of n = {}" . f ormat (n))   # Use the sympy.partition () method nth_partition = partition (n)    print ( "Value of nth partition number: {}" . format (nth_partition))  `

` `

Exit :

` Value of n = 7 Value of nth partition number: 15 `

Example # 2:

 ` # import sympy ` ` from ` ` sympy ` ` import ` ` * `    ` n ` ` = ` ` 10 ` ` print ` ` (` ` "Value of n = {}" ` `. ` ` format ` ` (n)) `   ` # Use the sympy.partition () method ` ` n_partition ` ` = ` ` [partition (x) ` ` for ` ` x ` ` in ` ` range ` ` (` ` 1 ` `, ` ` 11 ` `)] `   ` print ` < code class = "plain"> ( ` "N partition number are: {}" ` `. ` ` format ` ` (n_partition)) `

Exit :

` Value of n = 10 N partition number are: [1, 2, 3, 5, 7, 11, 15, 22, 30, 42] `

## Shop Learn programming in R: courses

\$ Best Python online courses for 2022

\$ Best laptop for Fortnite

\$ Best laptop for Excel

\$ Best laptop for Solidworks

\$ Best laptop for Roblox

\$ Best computer for crypto mining

\$ Best laptop for Sims 4

\$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

NUMPYNUMPY

How to convert Nonetype to int or string?

NUMPYNUMPY

How to specify multiple return types using type-hints

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

## Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method