On Wed, 2005-05-11 at 15:24, Aaron Sherman wrote:
> This smells like homework, but *shrug*

Then my mailer decided to play the role of the proverbial dog and eat
said homework ;-) If it does so again, I'll just leave well-enough
alone.

> On Wed, 2005-05-11 at 14:59, John Tsangaris wrote:

> > I was asked to provide the 73 occurrence of a sequence of numbers,
> > with the numbers 12345. Each number can be used only once, and there
> > are a possible 120 combinations.

perl -le '$n=0;sub x{my($s,@l)[EMAIL PROTECTED];if (@l){for my 
$l(@l){x($s.$l,grep{$_ ne [EMAIL PROTECTED])}}else{print ++$n," 
",$s}}x("",1,2,3,4,5)'

That can be golfed if you feel like it, but I've stripped it down to the
essentials.

Oh, and a correction. There is only ONE combination. There are 120
PERMUTATIONS. Different.

-- 
Aaron Sherman <[EMAIL PROTECTED]>
Senior Systems Engineer and Toolsmith
"It's the sound of a satellite saying, 'get me down!'" -Shriekback


 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to