I doubt there is a module for doing this.

It is a standard problem although you will more commonly see it as a question 
of how many ways you can give change in a particular monetary transaction. It 
is not a trivial problem. The way this is solved is with a particular 
generating function which you have to Taylor expand and then find the 
coefficient in front of the term that is x^9 in your case. See:

http://math.stackexchange.com/questions/67329/how-can-i-reduce-a-number

which also includes a Mathematica function for the calculation - which you 
might be able to convert to Perl together with Math::Caclulus::TaylorSeries or 
something like that. I have not tried - and for all I know there could be a 
routine to do this hidden in the depths of CPAN.

        Cheers,
                Jarle.



On 26 Jan 2013, at 21:26, MARK BAKER wrote:

> 
> Hey all ,
> 
> I have been trying to find away to find variables in a matrix and wondering 
> if there
> is a module that can do that for instance 
> 
> $x = sequence(3,3);
> p $x;
> 
> [0,1,2]
> [3,4,5]
> [6,7,8]
> 
> #############################
> 
> so if this is my matrix and I want to find all sums of  "9"
> 
> then the module would return 
> 
> 
> [3,6]
> [2,7]
> [1,8]
> [4,5]
> 
> or a binary reference like
> 
> [0,0,1]
> [0,0,0]    == [2,7]
> [0,1,0]  
> 
> is there a module that can do this ....  
> or return a binary matrix like
> 
> please let me know thanks
> 
> -Mark
> 
> "sometimes I think perl is alive"
> 
> 
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl


_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to