Practical numbers: Difference between revisions

Content added Content deleted
(→‎Python: Faster version: Check sum of factors can reach x-1.)
Line 128: Line 128:
=={{header|Phix}}==
=={{header|Phix}}==
{{trans|Python|(the composition of functions version)}}
{{trans|Python|(the composition of functions version)}}
<!--<lang Phix>-->
<!--<lang Phix>(phixonline)-->
<span style="color: #008080;">function</span> <span style="color: #000000;">sum_of_any_subset</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">n</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">sequence</span> <span style="color: #000000;">f</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">sum_of_any_subset</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">n</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">sequence</span> <span style="color: #000000;">f</span><span style="color: #0000FF;">)</span>
<span style="color: #000080;font-style:italic;">-- return true if any subset of f sums to n.</span>
<span style="color: #000080;font-style:italic;">-- return true if any subset of f sums to n.</span>