Tonelli-Shanks algorithm: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) m (→{{header|Perl 6}}: removed test value causing crash) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Restore failing test as bug in compiler has been fixed) |
||
Line 1,208: | Line 1,208: | ||
=={{header|Perl 6}}== |
=={{header|Perl 6}}== |
||
{{works with|Rakudo|2018. |
{{works with|Rakudo|2018.04}} |
||
Translation of the Wikipedia pseudocode, heavily influenced by Sidef and Python. |
Translation of the Wikipedia pseudocode, heavily influenced by Sidef and Python. |
||
Line 1,254: | Line 1,254: | ||
(665820697, 1000000009), |
(665820697, 1000000009), |
||
(881398088036, 1000000000039) |
(881398088036, 1000000000039) |
||
⚫ | |||
⚫ | |||
); |
); |
||
Line 1,261: | Line 1,263: | ||
say "Roots of $n are ($t, {$p-$t}) mod $p"; |
say "Roots of $n are ($t, {$p-$t}) mod $p"; |
||
}</lang> |
}</lang> |
||
<!-- fails with 'Cannot unbox 164 bit wide bigint into native integer', but save for eventual restore: |
|||
⚫ | |||
⚫ | |||
--> |
|||
{{out}} |
{{out}} |
||
<pre>Roots of 10 are (7, 6) mod 13 |
<pre>Roots of 10 are (7, 6) mod 13 |
||
Line 1,273: | Line 1,272: | ||
Roots of 665820697 are (378633312, 621366697) mod 1000000009 |
Roots of 665820697 are (378633312, 621366697) mod 1000000009 |
||
Roots of 881398088036 are (791399408049, 208600591990) mod 1000000000039 |
Roots of 881398088036 are (791399408049, 208600591990) mod 1000000000039 |
||
⚫ | |||
</pre> |
|||
⚫ | |||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |