Modular arithmetic: Difference between revisions

→‎{{header|Nim}}: insert Mathematica solution
(Swift: add missing operator definition)
(→‎{{header|Nim}}: insert Mathematica solution)
Line 889:
{{out}}
<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}}==
1,934

edits