Carmichael 3 strong pseudoprimes: Difference between revisions
Content added Content deleted
(→{{header|ALGOL 68}}: Avoid line-wrap) |
(added RPL) |
||
Line 3,286: | Line 3,286: | ||
61 3361 4021 824389441 |
61 3361 4021 824389441 |
||
</pre> |
</pre> |
||
=={{header|RPL}}== |
|||
{{works with|HP|49}} |
|||
« { } |
|||
2 ROT '''FOR''' p1 |
|||
2 p1 1 - '''FOR''' h3 |
|||
'''IF''' h3 p1 < '''THEN''' |
|||
1 h3 p1 + 1 - '''FOR''' d |
|||
'''IF''' h3 p1 + p1 1 - * d MOD NOT p1 SQ NEG h3 MOD d h3 MOD == AND '''THEN''' |
|||
p1 1 - h3 p1 + d IQUOT * 1 + |
|||
'''CASE''' |
|||
DUP ISPRIME? NOT '''THEN''' DROP '''END''' |
|||
p1 OVER * h3 IQUOT 1 + |
|||
DUP ISPRIME? NOT '''THEN''' DROP2 '''END''' |
|||
DUP2 * p1 1 - MOD 1 ≠ '''THEN''' DROP2 '''END''' |
|||
p1 UNROT 3 →LIST 1 →LIST + |
|||
'''END''' |
|||
'''END''' |
|||
'''NEXT''' |
|||
'''END''' |
|||
'''NEXT''' |
|||
p1 NEXTPRIME 1 - 'p1' STO |
|||
'''NEXT''' |
|||
» '<span style="color:blue">CARMIC</span>' STO |
|||
61 <span style="color:blue">CARMIC</span> |
|||
{{out}} |
|||
<pre> |
|||
1: { { 3 11 17 } { 5 29 73 } { 5 17 29 } { 5 13 17 } { 7 19 67 } { 7 31 73 } { 7 13 31 } { 7 73 103 } { 7 13 19 } { 13 61 397 } { 13 37 241 } { 13 97 421 } { 13 37 97 } { 13 37 61 } { 17 353 1201 } { 19 199 271 } { 23 199 353 } { 29 113 1093 } { 29 197 953 } { 31 991 15361 } { 31 61 631 } { 31 151 1171 } { 31 61 271 } { 31 61 211 } { 31 271 601 } { 31 181 331 } { 37 109 2017 } { 37 73 541 } { 37 613 1621 } { 37 73 181 } { 37 73 109 } { 41 1721 35281 } { 41 881 12041 } { 41 241 761 } { 41 241 521 } { 43 631 13567 } { 43 127 2731 } { 43 127 1093 } { 43 211 757 } { 43 631 1597 } { 43 127 211 } { 43 211 337 } { 43 547 673 } { 43 3361 3907 } { 47 3359 6073 } { 47 1151 1933 } { 47 3727 5153 } { 53 53 937 } { 53 157 2081 } { 53 157 521 } { 59 1451 2089 } { 61 421 12841 } { 61 181 5521 } { 61 61 1861 } { 61 61 1861 } { 61 181 1381 } { 61 541 3001 } { 61 661 2521 } { 61 241 421 } { 61 3361 4021 } } |
|||
</pre> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||
{{works with|Ruby|1.9}} |
{{works with|Ruby|1.9}} |
||
Line 3,395: | Line 3,425: | ||
61 x 3361 x 4021 |
61 x 3361 x 4021 |
||
</pre> |
</pre> |
||
=={{header|Rust}}== |
=={{header|Rust}}== |
||
<syntaxhighlight lang="rust"> |
<syntaxhighlight lang="rust"> |