From: Paul Smith Date: 2009-11-12T00:56:06+09:00 Subject: Re: Roman Numerals (Arrgh!) On Wed, Nov 11, 2009 at 3:51 PM, Gennady Bystritsky wrote: > > On Nov 11, 2009, at 5:35 AM, Rob Biedenharn wrote: > >>>> >>>> And with an appropriately formed $numerals array, the "subtraction >>>> rule" is already covered. ;-) >>> >>> Would you please elaborate? You mean same algorithm and "better" >>> $numerals would cover mapping of 4 => "IV", 9 => "IX", etc.? >>> >>>> >>>> -Rob >> >> >> Yes, that's it exactly. Testing/using 9 before 5, you find IX (and >> stop) before you go to VIIII. You can't repeat one of the "subtraction >> groups" the way that you can repeat the individual numerals: 8 is >> always VIII and never IVIV or IIX > > Now you intrigued me ;-). So I am asking directly -- given the following $numerals: > $numerals = [[1000, "M"], [500, "D"], [100, "C"], [50, "L"], [10, "X"], [5, "V"], [1, "I"]] $numerals = [[1000, "M"], [900, "CM"], [500, "D"], [400, "CD"], [100, "C"], [90, "XC"], [50, "L"], [40, "XL"], [10, "X"], [9, "IX"], [5, "V"], [4, "IV"], [1, "I"]] > > ...how one can transform it so that the original algorithm would produced shortened roman numbers? Please present the exact value of $numerals satisfying the above condition. > > Gennady. > -- Paul Smith http://www.nomadicfun.co.uk paul@pollyandpaul.co.uk