Chinese remainder theorem: Difference between revisions
Content deleted Content added
added R |
Added local variables |
||
Line 698:
' returns x where (a * x) % b == 1
_Mul_Inv ' ( a b -- n)
a = Pop()▼
y = 1▼
If b@ = 1 Then
Push 1
Return
EndIf
Do While a@ > 1
Loop
If
Push
Return
_Chinese_Remainder ' ( len -- n)
▲ s = 0
▲ a@ = Pop()
For i = 0 Step 1 While i < l▼
b@ = b@ * @(d@)
Next
For
Push
Next
Push (
Return
</lang>
{{out}}
<pre>
Line 744 ⟶ 749:
1000
0 OK, 0:
</pre>
|