|There's more than one way to do things|
Re^5: Algorithm for cancelling common factors between two lists of multiplicandsby sk (Curate)
|on Aug 12, 2005 at 16:57 UTC ( #483339=note: print w/replies, xml )||Need Help??|
Sorry I did not mean to say you did not attribute the idea, I was just curious because you mentioned about implementation
I don't think I explained it very clearly. The idea I was trying to convey was if you have list of factorials then we should be able to find the besy way to subract them
Let's consider your example
Under this situation subracting d & z, c & y, b & x, a & w and leaving v as is will be the best ordering possible or in other words, there will not be a better subtraction process that will give us fewer total number of elements.
I left at subract (d & z) because (d can > z) or (d can be < z) so it will either go into the numerator or denomiator. But that's a simple logic to check and assign correctly
What i set out to prove was just that i.e. if you sort the lists and subract the like indices then you are gauranteed (?yet to be proved rigourously) to get the least possible number of elements after one round of cancellation! I do not think I was able to prove it in a sophisticated way but it seems to be suggesting it is correct...maybe it will be easier to run some test cases to actually check if the conjecture is true :)
If the above conjecture is true or at least intuitive then there is no ambiguity in the way subtraction should be done!
In Section Seekers of Perl Wisdom