+

# Python sympy | sieve.search () method

Using the sympy.sieve.search () method, we can find the indices i, j of prime numbers that limit the given number. If the given number is prime, then i == j .

Syntax: sieve.search (n)
Parameter:
n - It denotes the number whose bounding prime indices is found.

Returns: Returns a tuple containing the bounding prime indices of n.

Example # 1:

 ` # import sympy ` ` from ` ` sympy ` ` import ` ` sieve ` ` `  ` # Use the sieve.search () method ` ` i, j ` ` = ` ` sieve.search (` ` 23 ` `) ` ` `  ` print ` ` (` `" The bounding prime indices of the number 23: {}, {} "` `. ` ` format ` ` (i, j)) `

Exit :

` The bounding prime indices of the number 23: 9, 9 `

Example # 2:

 ` # import sympy ` ` from ` ` sympy ` ` import ` ` sieve `   ` # Use the sieve.search () method ` ` i, j ` ` = ` ` sieve.search (` ` 25 ` `) `   ` print ` ` (` ` "The bounding prime indices of the number 23: {}, {}" ` `. ` ` format ` ` (i, j)) `

Exit :

``` The bounding prime indices of the number 23: 9, 10

```