File size: 512 Bytes
93237a0
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mods = [(5, 2), (7, 3), (9, 4)]
n, step = 0, 1
for modulus, remainder in mods:
    while n % modulus != remainder:
        n += step
    step *= modulus  # Bu örnekte modüller aralarında asal.
first = n
q = max(0, (1000 - first + step - 1) // step)
above = first + q * step
assert all(above % m == r for m, r in mods)
assert above >= 1000 and above - step < 1000
result = {"first": first, "period": step, "first_at_least_1000": above}
import json
print(json.dumps(result, ensure_ascii=False, sort_keys=True))