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
Hey there!
I seem to have a problem in understanding "Problem 55" (The "Lychrel-Numbers") correctly.
My algorithm works quite well and returns a total of 246 Lychrel-Numbers below 10,000. But for some reason that is not the expected answer to that problem. However, I looked for "Lychrel-Numbers" in the (German-) Wikipedia http://de.wikipedia.org/wiki/Lychrel-Zahl. There are listed all Lychrel-Numbers below 3,000 and those are exactly the ones that my algorithm also outputs as Lychrel-Numbers. Furthermore there is a table given that says that there are (in total) 246 Lychrel-Numbers below 10,000 (what is exactly the value that my algorithm calculates).
Does anybody have an idea what could be wrong there? Is Wikipedia wrong?
I know the "requested" answer to that problem, but I do not understand where the difference between projecteuler.net's answer and the Wikipedia-value does come from.
sunnyalex wrote:I looked for "Lychrel-Numbers" in the (German-) Wikipedia http://de.wikipedia.org/wiki/Lychrel-Zahl. There are listed all Lychrel-Numbers below 3,000 and those are exactly the ones that my algorithm also outputs as Lychrel-Numbers. Furthermore there is a table given that says that there are (in total) XXX Lychrel-Numbers below 10,000 (what is exactly the value that my algorithm calculates).
Assuming I'm interpreting that table correctly, it disagrees slightly with my algorithm (which uses the 50-iteration threshhold specified in the problem). The English-language Wikipedia page says that no known non-Lychrel numbers less than 10,000 take more than 24 iterations.
One of the two must be wrong. For the purposes of this problem, you will get the desired answer if you correctly apply the 50-iteration rule.
edit:
The difference between the German table and my results can be explained by palindromic Lychrel numbers that the Germans didn't count.
Last edited by thundre on Sat Dec 29, 2012 12:15 pm, edited 1 time in total.
@sunnyalex
We realize you are new to this forum. For several reasons, problem numbers below 100 are padded with leading 0's to make them 3-digit numbers. Don't start a new subject if one already exists. You should also read the sticky thread entitled "Comments, questions and ..."
Your post has thus been merged with the proper thread.
When you assume something, you risk being wrong half the time.
thundre wrote:
edit:
The difference between the German table and my results can be explained by palindromic lychrel numbers that the Germans didn't count.
This was exactly the mistake in my algorithm. It skipped numbers that were palindromes themselves in the first step. Now I adjusted the algorithm and I get the requested result!
Thank you everybody.
And please excuse the inconveniences caused by me opening a new thread. I searched for "problem 55" and did not get any results so I did not notice that there was already a thread called "problem 055"
I really enjoy encountering new ideas that stem from the Project Euler problems. Thank you, Euler & team! I extended my problem solution a little bit to make a graph of the number iterations required against n. Then I did a little more reading.
I thought I'd share this link I came across in looking further into Lychrel numbers, as I didn't see it in this thread and thought people reading here may enjoy it: http://www.p196.org/
This question is unclear whether zero (0) is a Lychrel number, or if somehow a negative number could be. The definition of a Lychrel number should read:
"A positive integer that never forms a palindrome through the reverse and add process is called a Lychrel number."
Or the question should be posed, "How many positive Lychrel numbers are there below ten-thousand?"
When a problem "name" a number or concept that I'm not familiar with, I look it up.
From Wikipedia: A Lychrel number is a natural number that cannot form a palindrome through the iterative process of repeatedly reversing its digits and adding the resulting numbers.
There are times I wish the problems were more forthcoming with the terminology or use of conventions; but this one wasn't one of them.
I don't think it's fair to assume the reader would look up what a Lychrel number is: I avoid looking up terms in Project Euler problems because I'm afraid what I come across may spoil the problem for me. Especially in this problem, it was possible that looking up the relevant terms could reveal a formula to figure out how many Lychrel numbers are less than a given integer before I'd derived it.
Besides, I think this is a fairly easy fix, and one that clears up an ambiguity in which neither reading seemed preferable without external resources.
0+reverse(0)=0+0=0. 0 is a palindrome. So?
It seems to me that reverse(-1) is not defined, at least not as a number.
So it seems to me that you could have answered your questions yourself without looking up anything,
War ruins the life and health of untold numbers of innocent children.