{ multiply and divide remaining terms } 5 * 6 * 7 --------- 2 * 3 The program I had would have done this before multiplying 5 * 7 ----- 1 {result} 35 #### n!/k! = PI(x) where x goes from (k+1) to (n) assuming n > k; PI(x) stands for product of

#### #!/usr/bin/perl use strict; use warnings; # Numerator and Denominator specified as factorials [BrowserUk]'s example numbers my @snum = (44_289, 11_800, 10_389, 4570); my @sden = (56_089, 989, 9_400, 43_300, 2_400); # old list from previous node # my @snum = (44_289, 11_800, 10_389, 45_700); # my @sden = (56_089, 989, 9_400, 43_300, 11_800, 2_400); # @snum = sort {$b<=>$a} @snum; @sden = sort {$b<=>$a} @sden; my $i = 0; # Make the arrays equal size if (@snum < @sden) { foreach $i (@snum..$#sden) { $snum[$i] = 0;} } else { foreach $i (@sden..$#snum) { $sden[$i] = 0;} } print +($_,$/) for (@snum); print $/; print +($_,$/) for (@sden); print $/; my @nexp = (); my @dexp = (); # n!/k! = (k+1)..(n) [assuming n > k] for $i (0..$#snum) { if ($snum[$i] > $sden[$i]) { print ("Numerator: Going to push from ", $sden[$i]+1, " to ", $snum[$i],$/); push (@nexp, (($sden[$i]+1)..$snum[$i])); } elsif ($sden[$i] > $snum[$i]) { print ("Denominator: Going to push from ", $snum[$i]+1, " to ", $sden[$i],$/); push (@dexp, (($snum[$i]+1)..$sden[$i])); } } print ("Length of expanded numerator = ", scalar @nexp, $/); print ("Length of expanded denominator = ", scalar @dexp, $/); print ("Total Number of elements = ", scalar @nexp + scalar @dexp, $/); #### __END__ Denominator: Going to push from 44290 to 56089 Denominator: Going to push from 11801 to 43300 Numerator: Going to push from 9401 to 10389 Numerator: Going to push from 2401 to 4570 Denominator: Going to push from 1 to 989 Length of expanded numerator = 3159 Length of expanded denominator = 44289 Total Number of elements = 47448