`sympy`

library?At its core, ** sympy** is a library used for symbolic mathematics.

We use `pip`

to install `sympy`

. Refer to the following command:

```
pip install sympy
```

`primefactors`

methodThe ** primefactors method** is used to return a sorted list of prime factors of a given number.

Note:Prime factors are prime numbers that completely divide the given number to get zero as the remainder.

```
sympy.primefactors(n)
```

: This is the number for which prime factors need to be obtained.`n`

The method returns the prime factors of the given number.

import sympyn = 100print("The prime factors of %s is %s" % (n, sympy.primefactors(n)))

- Line 1: We import the
`sympy`

package. - Line 3: We define
`n`

. - Line 5: We use the
`sympy.primefactors()`

method to obtain the prime factors of`n`

.

TRENDING TOPICS