# Python | sympy.factorint() method

With the help of sympy.factorint() method, we can find the factors and their corresponding multiplicities of a given integer. For input less than 2, factorint() behaves as follows:

• – returns the empty factorization {}.
• – returns .
• – adds to the factors and then factors .

Syntax:
factorint(n)

Parameter:
n – It denotes an integer.

Returns:
Returns a dictionary containing the prime factors of n as keys
and their respective multiplicities as values.

Example #1:

 `# import factorint() method from sympy ` `from` `sympy ``import` `factorint ` ` `  `n ``=` `2``*``*``3` `*` `3``*``*``4` `*` `5``*``*``6` ` `  `# Use factorint() method  ` `factor_dict ``=` `factorint(n)  ` `     `  `print``(``"Dictionary containing factors of {} with respective multiplicities : {}"``. ` `      ``format``(n, factor_dict)) `

Output:

```Dictionary containing factors of 10125000
with respective multiplicities : {2: 3, 3: 4, 5: 6}
```

Example #2:

 `# import factorint() method from sympy ` `from` `sympy ``import` `factorint ` ` `  `n ``=` `6``*``*``4` `*` `13` ` `  `# Use factorint() method  ` `factor_dict ``=` `factorint(n)  ` `     `  `print``(``"Dictionary containing factors of {} with respective multiplicities : {}"``. ` `      ``format``(n, factor_dict)) `

Output:

```Dictionary containing factors of 16848
with respective multiplicities : {2: 4, 3: 4, 13: 1}
```

My Personal Notes arrow_drop_up Coder Machine Learner Social Activist Vocalist

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.