problem 055

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.
User avatar
rayfil
Administrator
Posts: 1412
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: problem 055

Post by rayfil »

From the description of the problem:
A number that never forms a palindrome through the reverse and add process is called a Lychrel number.
And also:
Surprisingly, there are palindromic numbers that are themselves Lychrel numbers; the first example is 4994.
Edit: Sorry TripleM for the cross-post.
When you assume something, you risk being wrong half the time.
sunnyalex
Posts: 2
Joined: Fri Dec 28, 2012 3:36 pm

Problem 55

Post by sunnyalex »

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.

Kind regards!
Keep up the good work!
Alex
TripleM
Posts: 384
Joined: Fri Sep 12, 2008 3:31 am

Re: Problem 55

Post by TripleM »

There's already a thread for problem 55 here: viewtopic.php?f=50&t=1746

I suspect you'll find an answer to your problem there (or, as it stands, the problem statement).
thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: problem 055

Post by thundre »

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.
Image
User avatar
rayfil
Administrator
Posts: 1412
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: problem 055

Post by rayfil »

@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.
sunnyalex
Posts: 2
Joined: Fri Dec 28, 2012 3:36 pm

Re: problem 055

Post by sunnyalex »

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" :-)

Kind regards!
Alex
Jeptha
Posts: 1
Joined: Thu Mar 17, 2016 5:32 am

Re: problem 055

Post by Jeptha »

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/
TheBonobo4
Posts: 17
Joined: Sun Jul 12, 2015 9:51 pm

Re: problem 055

Post by TheBonobo4 »

Numberphile did a video on Lychrel numbers. Might be useful for the problem at hand.
Image
AMWJ
Posts: 2
Joined: Wed Feb 08, 2017 12:27 am

Re: problem 055

Post by AMWJ »

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?"
User avatar
dawghaus4
Posts: 56
Joined: Fri Nov 29, 2013 2:22 am

Re: problem 055

Post by dawghaus4 »

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.

Tom
AMWJ
Posts: 2
Joined: Wed Feb 08, 2017 12:27 am

Re: problem 055

Post by AMWJ »

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.
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: problem 055

Post by hk »

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,
Image
War ruins the life and health of untold numbers of innocent children.
bkarlenko
Posts: 1
Joined: Thu Dec 21, 2023 9:50 pm

Re: problem 055

Post by bkarlenko »

My algorithm works quite well and returns a total of 246 Lychrel-Numbers below 10,000.
Had the same problem. My total was 246 no matter how long I debug. It turned out I had to read the description better:
Surprisingly, there are palindromic numbers that are themselves Lychrel numbers; the first example is 4994
So when I included initial palindromes to my checks, I got the correct answer
Hope this helps those who search by "246" query
Post Reply