# HG changeset patch
# User David Loeffler <d.loeffler.01@cantab.net>
# Date 1292529962 0
# Node ID f13cd7f506238cea116cc5d3c4fbf81b7c58916d
# Parent 207cbed9fdf2e71be645cd4531077a8718c5ff64
#10484: Chinese remainder code raises an error when called with Python ints
diff -r 207cbed9fdf2 -r f13cd7f50623 sage/rings/arith.py
a
|
b
|
|
2735 | 2735 | Traceback (most recent call last): |
2736 | 2736 | ... |
2737 | 2737 | ValueError: No solution to crt problem since gcd(x^2 - 1,x^3 - 1) does not divide 2-x |
| 2738 | |
| 2739 | sage: crt(int(2), int(3), int(7), int(11)) |
| 2740 | 58 |
2738 | 2741 | """ |
2739 | 2742 | if isinstance(a, list): |
2740 | 2743 | return CRT_list(a, b) |
| 2744 | if isinstance(a, (int, long)): |
| 2745 | a = integer.Integer(a) # otherwise we get an error at (b-a).quo_rem(g) |
2741 | 2746 | g, alpha, beta = XGCD(m, n) |
2742 | 2747 | q, r = (b - a).quo_rem(g) |
2743 | 2748 | if r != 0: |