Modular arithmetic: Difference between revisions

Content added Content deleted
Line 1,712: Line 1,712:


=={{header|Mathematica}}/{{header|Wolfram Language}}==
=={{header|Mathematica}}/{{header|Wolfram Language}}==
The best way to do it is probably to use the finite fields package.
For versions prior to 13.3, the best way to do it is probably to use the finite fields package.
<syntaxhighlight lang="mathematica"><< FiniteFields`
<syntaxhighlight lang="mathematica"><< FiniteFields`
x^100 + x + 1 /. x -> GF[13]@{10}</syntaxhighlight>
x^100 + x + 1 /. x -> GF[13]@{10}</syntaxhighlight>
{{out}}
{{out}}
{1}<sub>13</sub>
{1}<sub>13</sub>

Version 13.3 has a "complete, consistent coverage of all finite fields":

<syntaxhighlight lang="mathematica">
OutputForm[
x^100 + x + 1 /. x -> FiniteField[13][10]
]
</syntaxhighlight>

We have to show the `OutputForm` though, because the `StandardForm` is not easy to render here.
{{out}}
<pre>FiniteFieldElement[<1,13,1,+>]</pre>


=={{header|Mercury}}==
=={{header|Mercury}}==