Chinese remainder theorem: Difference between revisions
Content added Content deleted
Line 973: | Line 973: | ||
=={{header|Frink}}== |
=={{header|Frink}}== |
||
This example solves an extended version of the Chinese Remainder theorem by allowing an optional third parameter <CODE>d</CODE> which is an integer. (This optional parameter is common in many/most real-world applications of the Chinese Remainder Theorem.) |
This example solves an extended version of the Chinese Remainder theorem by allowing an optional third parameter <CODE>d</CODE> which defaults to 0 and is an integer. The solution returned is the smallest solution >= d. (This optional parameter is common in many/most real-world applications of the Chinese Remainder Theorem.) |
||
This program also works with arbitrarily-large integers. |
|||
<lang frink>/** arguments: |
<lang frink>/** arguments: |
||
[r, m, d=0] where r and m are arrays of the remainder terms r and the |
[r, m, d=0] where r and m are arrays of the remainder terms r and the |