Perfect totient numbers: Difference between revisions
Content added Content deleted
(added RPL) |
|||
Line 2,735: | Line 2,735: | ||
</pre> |
</pre> |
||
=={{header|RPL}}== |
|||
{{works with|HP|49}} |
|||
« 0 OVER |
|||
'''WHILE''' DUP 1 ≠ '''REPEAT''' |
|||
EULER SWAP OVER + SWAP |
|||
'''END''' DROP == |
|||
» '<span style="color:blue">PTOT?</span>' STO |
|||
« → n |
|||
« { } 1 |
|||
'''WHILE''' n '''REPEAT''' |
|||
'''IF''' DUP <span style="color:blue">PTOT?</span> '''THEN''' |
|||
SWAP OVER + SWAP |
|||
'n' 1 STO- |
|||
'''END''' |
|||
2 + <span style="color:grey">@ Perfect totient numbers are odd</span> |
|||
'''END''' DROP |
|||
» » '<span style="color:blue">TASK</span>' STO |
|||
20 <span style="color:blue">TASK</span> |
|||
{{out}} |
|||
<pre> |
|||
1: { 3 9 15 27 39 81 111 183 243 255 327 363 471 729 2187 2199 3063 4359 4375 5571 } |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||
<syntaxhighlight lang="ruby">require "prime" |
<syntaxhighlight lang="ruby">require "prime" |
||
Line 2,760: | Line 2,783: | ||
<pre>3, 9, 15, 27, 39, 81, 111, 183, 243, 255, 327, 363, 471, 729, 2187, 2199, 3063, 4359, 4375, 5571 |
<pre>3, 9, 15, 27, 39, 81, 111, 183, 243, 255, 327, 363, 471, 729, 2187, 2199, 3063, 4359, 4375, 5571 |
||
</pre> |
</pre> |
||
=={{header|Rust}}== |
=={{header|Rust}}== |