Permutation test: Difference between revisions

m (→‎{{header|REXX}}: added/changed comments and whitespace, added a variable instead of hard-coding into the program.)
Line 796:
<pre><=: 80551 87.1972%
>: 11827 12.8028%</pre>
 
=={{header|Phix}}==
{{Trans|C}}
<lang Phix>constant data = {85, 88, 75, 66, 25, 29, 83, 39, 97,
68, 41, 10, 49, 16, 65, 32, 92, 28, 98 }
function pick(int at, int remain, int accu, int treat)
if remain=0 then return iff(accu>treat?1:0) end if
return pick(at-1, remain-1, accu+data[at], treat) +
iff(at>remain?pick(at-1, remain, accu, treat):0)
end function
int treat = 0, le, gt
atom total = 1;
for i=1 to 9 do treat += data[i] end for
for i=19 to 11 by -1 do total *= i end for
for i=9 to 1 by -1 do total /= i end for
gt = pick(19, 9, 0, treat)
le = total - gt;
printf(1,"<= : %f%% %d\n > : %f%% %d\n",
{100*le/total, le, 100*gt/total, gt})</lang>
{{out}}
<pre>
<= : 87.197168% 80551
> : 12.802832% 11827
</pre>
 
=={{header|PicoLisp}}==
7,815

edits