In order to make my $count look like your count will require more work - and make the process slower. If you want - you can change the position of $count++ to after the for loop. There you would only be counting the number of combinations that did not have a duplicate number in them and whose combined value was not greater than the target sum.
I would recommend in the real problem removing all candidates that were already larger than the target number.
Cheers - L~RIn reply to Re: Re: Re: amount permutations
by Limbic~Region
in thread amount permutations
by gr0k
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |