Chinese Remainder Theorem

824 views
Skip to first unread message

Santanu Sarkar

unread,
Sep 23, 2011, 12:39:51 AM9/23/11
to sage-s...@googlegroups.com
I want to find integer such that
x= 1 mod 3
x=2  mod 5
x=3  mod 7
like this system of congruences using Chinese Remainder Theorem.
In Sage, crt() function takes only 4 argument.

D. S. McNeil

unread,
Sep 23, 2011, 1:08:35 AM9/23/11
to sage-s...@googlegroups.com

sage: help(CRT)

crt(a, b, m=None, n=None)
Returns a solution to a Chinese Remainder Theorem problem.

INPUT:

- ``a``, ``b`` - two residues (elements of some ring for which
extended gcd is available), or two lists, one of residues and
one of moduli.
[...]

If ``a`` and ``b`` are lists, returns a simultaneous solution to
the congruences `x\equiv a_i\pmod{b_i}`, if one exists.

.. SEEALSO::

- :func:`CRT_list`


sage: CRT([1,2,3],[3,5,7])
52
sage: x = CRT([1,2,3],[3,5,7])
sage: x % 3, x % 5, x % 7
(1, 2, 3)


Doug

Santanu Sarkar

unread,
Sep 23, 2011, 2:28:08 AM9/23/11
to sage-s...@googlegroups.com
Thank you.


--
To post to this group, send email to sage-s...@googlegroups.com
To unsubscribe from this group, send email to sage-support...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply all
Reply to author
Forward
0 new messages