Modular arithmetic: Difference between revisions
Content added Content deleted
(Swift: add missing operator definition) |
(→{{header|Nim}}: insert Mathematica solution) |
||
Line 889: | Line 889: | ||
{{out}} |
{{out}} |
||
<pre>x ^ 100 + x + 1 for ModInt(10, 13) is ModInt(1, 13)</pre> |
<pre>x ^ 100 + x + 1 for ModInt(10, 13) is ModInt(1, 13)</pre> |
||
=={{header|Mathematica}}/{{header|Wolfram Language}}== |
|||
The best way to do it is probably to use the finite fields package. |
|||
<lang Mathematica><< FiniteFields` |
|||
x^100 + x + 1 /. x -> GF[13]@{10}</lang> |
|||
{{out}} |
|||
{1}<sub>13</sub> |
|||
=={{header|Nim}}== |
=={{header|Nim}}== |