Problem 089

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
Forum rules
As your posts will be visible to the general public you
are requested to be thoughtful in not posting anything
that might explicitly give away how to solve a particular problem.

This forum is NOT meant to discuss solution methods for a problem.

In particular don't post any code fragments or results.

Don't start begging others to give partial answers to problems

Don't ask for hints how to solve a problem

Don't start a new topic for a problem if there already exists one


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
AnzaPower
Posts: 6
Joined: Thu Sep 27, 2012 9:37 am

Please add clarification to "About Roman Numerals" page...

Post by AnzaPower »

Hi, In Problem 89 there's a misunderstanding in the About Roman Numerals page, it was not apparent to me that you cannot use the same subtractive pair twice in a row, for example 18, my code generated IXIX (9+9), but you seem to expect XVIII, there was no way for me to know that...

Funny thing, I wrote the code in August last year, been coming back to it once every few months trying to find the bug, feels so good to finally have that problem solved...

EDIT by mpiotte:
I merged your topic with an already existing one.
Please check in the future if there already exists a topic for a problem.
Image

RJCunningham
Posts: 1
Joined: Sat Apr 12, 2014 7:50 am

Re: Problem 089

Post by RJCunningham »

Hello,
I'm having issues with this problem and I figured I would ask here for some advice/help. From reading this thread, I've gathered that I think I understand the numerals correctly (and that MMMMCM is a valid way of writing 4900). In addition, I am getting the same number of characters saved for the first 30 as I should be getting, but my answer is not correct. Should I PM someone a list of savings for each case so I can see where my code is going wrong? I believe I am handling the end of file correctly, as I can see the savings from the last case, so I'm really not sure what could be wrong and don't really want to check every case to find the error.

EDIT: I used a smarter algorithm and caught my error in the one case that has just one numeral. Silly dumb me writing lazy code as usual.

gelatine1
Posts: 4
Joined: Sun Sep 16, 2012 4:12 pm

Roman numerals / problem 89

Post by gelatine1 »

Hi, I was wondering what happens with numbers above 5000 ? How should they be written ? Do they occur in problem 89 ? It would require to write more than 4 M's next to each other so I'm a little confused
Image

User avatar
nicolas.patrois
Posts: 118
Joined: Fri Jul 26, 2013 4:54 pm
Contact:

Re: Roman numerals / problem 89

Post by nicolas.patrois »

There is already a thread for this problem.

Note: You can assume that all the Roman numerals in the file contain no more than four consecutive identical units.
Image

User avatar
mpiotte
Administrator
Posts: 1914
Joined: Tue May 08, 2012 5:40 pm
Location: Montréal, Canada

Re: Roman numerals / problem 89

Post by mpiotte »

nicolas.patrois wrote:There is already a thread for this problem...
Merged threads.
Image

User avatar
angzhiping
Posts: 32
Joined: Sat Aug 09, 2014 3:51 pm
Location: Jurong East, Singapore
Contact:

Re: Problem 089

Post by angzhiping »

cottonvibes wrote:Guys I want to report what some other people were saying, which makes the answer to problem 89 on the site wrong.

By following the rules euler wrote in the FAQ: http://projecteuler.net/index.php?secti ... n_numerals
Numerals must be arranged in descending order of size.
1. Only I, X, and C can be used as the leading numeral in part of a subtractive pair.
2. I can only be placed before V and X.
3. X can only be placed before L and C.
4. C can only be placed before D and M.
The following numbers should be valid:
IXIX = 9 + 9 = 18
XCXC = 90 + 90 = 180
CMCM = 900 + 900 = 1800

There is no rule these numbers break from above.
Therefore, either the rules on the FAQ need to be changed to explicitly say "no repeats of same subtractive-pair numbers", or the answer needs to be changed on the site.

For anyone wondering, the answer to the question currently does not allow repeats.
Therefor, for the above numbers it wants:
XVIII = 10 + 5 + 1 + 1 + 1 = 18
CLXXX = 100 + 50 + 10 + 10 + 10 = 180
MDCCC = 1000 + 500 + 100 + 100 + 100 = 1800
Second this. Can the problem setter for PE89 look into this?
Image
170825_b3d528c2bf87aaeff2a0ff93382fba94

User avatar
euler
Administrator
Posts: 3317
Joined: Sun Mar 05, 2006 4:49 pm
Location: Cheshire, England
Contact:

Re: Problem 089

Post by euler »

angzhiping wrote:Can the problem setter for PE89 look into this?
That would be me - nearly ten years ago!

I know this isn't the example given, but if XLI (41) is valid and IXI is invalid, can you see why?
In addition, if you use I before X to indicate then 1 is being subtracted from 10 then you are declaring that the "total" must less than 10. Remember, the Roman numeral system is fundamentally an additive system: something plus something plus something..., where subtractive combinations, if used correctly, are permitted to be used for brevity. So any number beginning IX indicates already that the total value of the number is below 10. Placing anything after IX makes the total equal to or greater than ten which is a nonsense.

Anyway I take the points about the problem not being clear so I have updated the problem statement and expanded the information on the "About... Roman Numerals" page to make, I hope, everything clearer.
Problem 89 (View Problem)
Image
impudens simia et macrologus profundus fabulae

User avatar
solarmew
Posts: 42
Joined: Thu Jan 01, 2015 3:52 pm

Re: Problem 089

Post by solarmew »

this problem sucks ... =_______= ... i literally don't even know where to begin ... maybe i'm just tired
Image
366541_5799d51e95657e1a227f2cb86bd181de

jason.levy
Posts: 6
Joined: Fri Oct 09, 2015 6:45 pm

Re: Problem 089

Post by jason.levy »

euler wrote:Anyway I take the points about the problem not being clear so I have updated the problem statement and expanded the information on the "About... Roman Numerals" page to make, I hope, everything clearer.
Reading through the rules, I didn't realize at first that rule 2 applies even to X's that don't appear. Perhaps that could be emphasized.

User avatar
jaap
Posts: 551
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: Problem 089

Post by jaap »

jason.levy wrote:
euler wrote:Anyway I take the points about the problem not being clear so I have updated the problem statement and expanded the information on the "About... Roman Numerals" page to make, I hope, everything clearer.
Reading through the rules, I didn't realize at first that rule 2 applies even to X's that don't appear. Perhaps that could be emphasized.
It has as an example:
We could not write IIIIIIIIIIIIIIII because we are making X (ten) from smaller denominations.
Is that not clear enough?

jason.levy
Posts: 6
Joined: Fri Oct 09, 2015 6:45 pm

Re: Problem 089

Post by jason.levy »

jaap wrote:
jason.levy wrote:Reading through the rules, I didn't realize at first that rule 2 applies even to X's that don't appear. Perhaps that could be emphasized.
It has as an example:
We could not write IIIIIIIIIIIIIIII because we are making X (ten) from smaller denominations.
Is that not clear enough?
Sure, the explanation makes it unambiguous. I'm only suggesting that the rule itself would be clearer with a couple of words distinguishing X's that need not appear and smaller denominations that do. It's not really a big deal.

square1001
Posts: 27
Joined: Tue Mar 15, 2016 2:58 am
Location: Tokyo, Japan
Contact:

Re: Problem 089

Post by square1001 »

I think $5000 = \bar{V}$. It's written in this page.

So, $4900 = MMMMCM = C \bar{V}$.

Is this problem says 4900 can represent only 2 characters?
Image

User avatar
dawghaus4
Posts: 56
Joined: Fri Nov 29, 2013 2:22 am

Re: Problem 089

Post by dawghaus4 »

square1001 wrote:I think $5000 = \bar{V}$. It's written in this page.

So, $4900 = MMMMCM = C \bar{V}$.

Is this problem says 4900 can represent only 2 characters?
I've never seen a roman numeral character for 5000, not even on the page you linked to. On that page, when I enter 5000 into the pages converter, I'm told that 5000 is an invalid number.

Regardless, the problem links to a page About...Roman Numerals, which has "the definitive rules for this problem."

Tom

square1001
Posts: 27
Joined: Tue Mar 15, 2016 2:58 am
Location: Tokyo, Japan
Contact:

Re: Problem 089

Post by square1001 »

You said "I entered 5000 into the roman numeral converter, so it was an invalid number".

But, It is written under the converter, in the list of roman numerals.

This page written: $5000 = \bar{V}$, $10000 = \bar{X}$, $50000 = \bar{L}$, $100000 = \bar{C}$, $500000 = \bar{D}$, and $1000000 = \bar{M}$.

Thank you for reading.
Image

v6ph1
Posts: 122
Joined: Mon Aug 25, 2014 7:14 pm

Re: Problem 089

Post by v6ph1 »

The use of numerals beyond 1000 (M) was not common.
Just write the larger numbers with M only.
Image

User avatar
dawghaus4
Posts: 56
Joined: Fri Nov 29, 2013 2:22 am

Re: Problem 089

Post by dawghaus4 »

square1001 wrote:You said "I entered 5000 into the roman numeral converter, so it was an invalid number".

But, It is written under the converter, in the list of roman numerals.

This page written: $5000 = \bar{V}$, $10000 = \bar{X}$, $50000 = \bar{L}$, $100000 = \bar{C}$, $500000 = \bar{D}$, and $1000000 = \bar{M}$.

Thank you for reading.
Regardless, the problem links to a page About...Roman Numerals, which has "the definitive rules for this problem."

vjcinjr
Posts: 5
Joined: Mon Aug 22, 2016 2:35 am
Location: New York, USA

Re: Problem 089

Post by vjcinjr »

Still confused about the rules. Is LD a valid representation of 450? If not, what rule does it violate?

v6ph1
Posts: 122
Joined: Mon Aug 25, 2014 7:14 pm

Re: Problem 089

Post by v6ph1 »

Rule i: "Only one I, X, and C can be used as the leading numeral in part of a subtractive pair."
Image

vjcinjr
Posts: 5
Joined: Mon Aug 22, 2016 2:35 am
Location: New York, USA

Re: Problem 089

Post by vjcinjr »

v6ph1 wrote:
Thu Feb 23, 2017 12:46 am
Rule i: "Only one I, X, and C can be used as the leading numeral in part of a subtractive pair."
Ah - but that rule could be interpreted as giving restrictions on I, X and C because it says nothing about V, L or D.

I assume from your response that the rule means 'only I, X OR C can be used as a leading numeral in part of a subtractive pair AND when used in that way only one of those (not two or three) can be used in that way'. In other words, in the phrase 'subtractive pair' the word 'pair' means only two characters (i.e., IIX would be invalid because it is more than a 'pair' of 2 numerals.).

Thanks much for the quick response.

Junglemath
Posts: 54
Joined: Fri Sep 20, 2019 1:25 pm
Location: Minsk

Re: Problem 089

Post by Junglemath »

I think this entire problem needs to be rewritten, judging by the number of people who are utterly at sea regarding the rules to be followed in writing Roman numerals. For example, after giving the three basic rules in bold, it then discusses subtractive combinations, which immediately violates the first rule about numbers having to be written in descending size. An exception that is allowed to break the first basic rule should be highlighted as such.

Considering all this, it is very surprising that so many people actually managed to solve it.

Post Reply