Python sympy | sieve.search() method Last Updated : 27 Aug, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report With the help of sympy.sieve.search() method, we can find the indices i, j of the primes that bound a 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: Python3 # import sympy from sympy import sieve # Use sieve.search() method i, j = sieve.search(23) print("The bounding prime indices of the number 23 : {}, {}".format(i, j)) Output: The bounding prime indices of the number 23 : 9, 9 Example #2: Python3 # import sympy from sympy import sieve # Use sieve.search() method i, j = sieve.search(25) print("The bounding prime indices of the number 23 : {}, {}".format(i, j)) Output: The bounding prime indices of the number 23 : 9, 10 Comment More infoAdvertise with us Next Article Python sympy | sieve.extend() method R rupesh_rao Follow Improve Article Tags : Python SymPy Practice Tags : python Similar Reads Python | sympy.randprime() method With the help of sympy.randprime() method, we can find a random prime number in the range [a, b), where a and b are parameters to the method. Syntax: randprime(a, b) Parameter: a - It denotes the start of the range. It is inclusive. b - It denotes the end of the range. It is not inclusive. Returns: 1 min read Python sympy | sieve.extend() method With the help of sympy.sieve.extend() method, we can grow the sieve to cover all the prime numbers less than equal to a given natural number. Syntax: sieve.extend(N) Parameter: N - It denotes the number up to which the sieve is extended. Returns: The function does not return anything. Example #1: Py 1 min read Python | sympy.sets.Ropen() method With the help of sympy.sets.Ropen() method, we can make a set of values by setting interval values like right open that means a set has right open bracket and left close one by using sympy.sets.Ropen() method. Syntax : sympy.sets.Ropen(val1, val2) Return : Return set of values with right open set. E 1 min read Python | sympy.sets.open() method With the help of sympy.sets.open() method, we can make a set of values by setting interval values like right open or left open that means a set has right open bracket and left open brackets by using sympy.sets.open() method. Syntax : sympy.sets.open(val1, val2) Return : Return set of values with rig 1 min read Python sympy | sieve.primerange() method With the help of sympy.sieve.primerange() method, we can generate all prime numbers for a given range [a, b). It returns a type generator object which can be converted to a list for further operations. Syntax: sieve.primerange(a, b) Parameters: a - It denotes the start of the range. It is inclusive. 1 min read Python | sympy.sets.Lopen() method With the help of sympy.sets.Lopen() method, we can make a set of values by setting interval values like left open that means a set has left open bracket and right close one by using sympy.sets.Lopen() method. Syntax : sympy.sets.Lopen(val1, val2) Return : Return set of values with left open set. Exa 1 min read Like