Perfect totient numbers: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: updated to the latest version of the program.) |
m (→{{header|REXX}}: changed the limit for the program.) |
||
Line 118: | Line 118: | ||
<lang rexx>/*REXX program calculates and displays the first N perfect totient numbers. */ |
<lang rexx>/*REXX program calculates and displays the first N perfect totient numbers. */ |
||
parse arg N . /*obtain optional argument from the CL.*/ |
parse arg N . /*obtain optional argument from the CL.*/ |
||
if N=='' | N=="," then N= |
if N=='' | N=="," then N= 20 /*Not specified? Then use the default.*/ |
||
p= 0 /*the count of perfect totient numbers.*/ |
p= 0 /*the count of perfect totient numbers.*/ |
||
@.=. /*memoization array of totient numbers.*/ |
@.=. /*memoization array of totient numbers.*/ |
||
Line 143: | Line 143: | ||
end /*m*/ |
end /*m*/ |
||
@.z= #; return # /*use memoization. */</lang> |
@.z= #; return # /*use memoization. */</lang> |
||
{{out|output|text= when using the default input of : <tt> |
{{out|output|text= when using the default input of : <tt> 20 </tt>}} |
||
<pre> |
<pre> |
||
The first |
The first 20 perfect totient numbers: |
||
3 9 15 27 39 81 111 183 243 255 327 363 471 729 2187 2199 3063 4359 4375 5571 |
3 9 15 27 39 81 111 183 243 255 327 363 471 729 2187 2199 3063 4359 4375 5571 |
||
</pre> |
</pre> |