Anonymous user
Permutations: Difference between revisions
m
→using numbers: added comments and whitespace, changed indentations.
m (→{{header|Sidef}}: be consistent) |
m (→using numbers: added comments and whitespace, changed indentations.) |
||
Line 3,871:
===using numbers===
This version is modeled after the '''Maxima''' program (as far as output).
<lang rexx>/*REXX program
parse arg n .; if n=='' | n=="," then n=3 /*Not specified? Then
do pop=1
do while nPerm(n, 0); call tell n; end /*while*/
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
do k=nm by -1 for nm; kp=k+1; if @.k<@.kp then do; i=k; leave; end; end /*k*/
do j=i+1 while
if i==0 then
do m=i+1 while @.m<@.i; end /*m*/▼
return
▲ do m=i+1 while @.m<@.i
/*──────────────────────────────────────────────────────────────────────────────────────*/
tell:
'''output''' when using the default input:
<pre>
1 2 3
|