Python | sympy.crt() method
With the help of sympy.crt() method, we can implement the Chinese Remainder Theorem in SymPy.
Syntax: crt(m, v)
Parameter:
m – It denotes a list of integers.
v – It denotes a list of integers.
Returns: Returns a tuple of integers where the first element is the required result.
Example #1:
# import crt() method from sympy from sympy.ntheory.modular import crt m = [5, 7] v = [1, 3] # Use crt() method crt_m_v = crt(m, v) print("Result of the Chinese Remainder Theorem = {} ".format(crt_m_v[0])) |
chevron_right
filter_none
Output:
Result of the Chinese Remainder Theorem = 31
Example #2:
# import crt() method from sympy from sympy.ntheory.modular import crt m = [99, 97, 95] v = [49, 76, 65] # Use crt() method crt_m_v = crt(m, v) print("Result of the Chinese Remainder Theorem = {} ".format(crt_m_v[0])) |
chevron_right
filter_none
Output:
Result of the Chinese Remainder Theorem = 639985
Recommended Posts:
- class method vs static method in Python
- Python | os.dup() method
- Python | next() method
- Python | set() method
- Python | os.lchown() method
- Python | cmath.log() method
- Python PIL | ImageOps.fit() method
- Python | sympy.Pow() method
- Python | os.lseek() method
- Python | isinstance() method
- Python | os.unlink() method
- Python | sympy.Mul() method
- Python | os.times() method
- Python | Tensorflow tan() method
- Python PIL | UnsahrpMask() method
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.


