Wilson primes of order n: Difference between revisions

Content added Content deleted
(→‎J: add a first draft)
(added RPL)
Line 1,350: Line 1,350:
11 │ 17 2,713
11 │ 17 2,713
───────┴─────────────────────────────────────────────────────────────
───────┴─────────────────────────────────────────────────────────────
</pre>

=={{header|RPL}}==
{{works with|HP|49}}
« → maxp
« { }
1 11 '''FOR''' n
{ } n
'''IF''' DUP ISPRIME? NOT '''THEN''' NEXTPRIME '''END'''
'''WHILE''' DUP maxp < '''REPEAT'''
n 1 - FACT OVER n - FACT * -1 n ^ -
'''IF''' OVER SQ MOD NOT '''THEN''' SWAP OVER + LOOK SWAP '''END'''
NEXTPRIME
'''END'''
DROP 1 →LIST +
'''NEXT'''
» » '<span style="color:blue">TASK</span>' STO
{{out}}
<pre>
1: { { 5 13 } { 2 3 11 } { 7 } { } { 5 7 } { 11 } { 17 } { } { } { 11 } { 17 } }
</pre>
</pre>


Line 1,386: Line 1,406:


</pre>
</pre>

=={{header|Rust}}==
=={{header|Rust}}==
<syntaxhighlight lang="rust">// [dependencies]
<syntaxhighlight lang="rust">// [dependencies]