Connection
Base URL, credentials and a reachable server.
Review congruences.py for the coprime assumption before using a combined residue as a schedule or index.
Base URL, credentials and a reachable server.
A model available through the configured endpoint.
Context limits and tool support are determined by the model and server.
import math
def merge_congruences(pairs):
if type(pairs) is not list or len(pairs) > 8:
raise ValueError("crt.input")
answer, period = 0, 1
for pair in pairs:
if type(pair) not in (list, tuple) or len(pair) != 2 or any(type(x) is not int for x in pair):
raise ValueError("crt.pair")
residue, modulus = pair
if abs(residue) > 10**9 or not 2 <= modulus <= 10**6 or math.gcd(period, modulus) != 1:
raise ValueError("crt.modulus")
step = ((residue-answer)*pow(period, -1, modulus)) % modulus
answer += period*step
period *= modulus
answer %= period
return answer, period