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
phaul
Posts: 2
Joined: Sun Nov 01, 2009 2:58 pm
Location: Watford, England
Contact:

problem 055

Post by phaul »

I think the example with 10667 is wrong. After a couple of iterations it arrives to the palindrome 2326666232.
Although this isn't relevant as far as the problem is concerned, should be rectified

10667 + 76601 == 87268
87268 + 86278 == 173546
173546 + 645371 == 818917
818917 + 719818 == 1538735
1538735 + 5378351 == 6917086
6917086 + 6807196 == 13724282
13724282 + 28242731 == 41967013
41967013 + 31076914 == 73043927
73043927 + 72934037 == 145977964
145977964 + 469779541 == 615757505
615757505 + 505757516 == 1121515021
1121515021 + 1205151211 == 2326666232.

Paul.
User avatar
phaul
Posts: 2
Joined: Sun Nov 01, 2009 2:58 pm
Location: Watford, England
Contact:

Re: problem 055

Post by phaul »

ah, ignore me ; I'm being an idiot. the example was 10677 :P
heiba
Posts: 2
Joined: Fri Apr 09, 2010 2:50 pm

Re: problem 055

Post by heiba »

Hey guys,

This is obviously about Problem 55 (View Problem)

I solved it, I got all the Lychrel numbers below 10000. Mentioned in the question, 196 and 4994 are Lycherals. I got them which confirms my method is correct. But I don't know why my answer is not accepted as correct. I made sure millions of times. I don't know what I can say and what I can't say in order not to spoil. But I followed the 50 iterations rule mentioned in the question, I made sure that they occur exactly 50 times not more or less. I tried changing it to 49 iterations, I got a slightly different number. I tried it, it's also wrong. I'm pretty sure about my first answer. and don't know what can I be missing ?

If you can't think of anything to help me with, can you please explain EXACTLY what does "How many Lychrel numbers are there below ten-thousand?" in case I misunderstood it, which is not probable.

Thanks everyone
heiba
Posts: 2
Joined: Fri Apr 09, 2010 2:50 pm

Re: problem 055

Post by heiba »

OOOPPPSSSSSS, that was the most unseen mistake I have ever did.

I used unsigned int thinking they'de be large enough, I WAS WRONG. had to use unsigned __int64 to avoid numbers being overlapped. DAMN IT. coding in C++ btw
User avatar
rayfil
Administrator
Posts: 1412
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: problem 055

Post by rayfil »

I used unsigned int thinking they'de be large enough
It's just another example satisfying my usual signature. :( :(
When you assume something, you risk being wrong half the time.
User avatar
Seralt
Posts: 2
Joined: Tue Oct 12, 2010 9:07 pm
Location: Ontario, Canada

Re: problem 055

Post by Seralt »

I'm somewhat unclear on the parameters of the problem. Does the reverse of a number have to maintain the same length of digits? (e.g. if "1" is the reverse of "10", then 10+1 == 11, which is a palindrome.)
User avatar
elendiastarman
Posts: 410
Joined: Sat Dec 22, 2007 8:15 pm

Re: problem 055

Post by elendiastarman »

Seralt wrote:I'm somewhat unclear on the parameters of the problem. Does the reverse of a number have to maintain the same length of digits? (e.g. if "1" is the reverse of "10", then 10+1 == 11, which is a palindrome.)
Leading zeros are not allowed in this case. In your example, you're really doing 01+10 = 11. Hence, yes, the reverse of a number will have the same number of digits.

That help?
Want some
3.14159265358979323846264338327950288419716939937510
58209749445923078164062862089986280348253421170679...?
Image
User avatar
Lord_Farin
Posts: 239
Joined: Wed Jul 01, 2009 10:43 am
Location: Netherlands

Re: problem 055

Post by Lord_Farin »

elendiastarman wrote: Leading zeros are not allowed in this case.
Please point to a PE problem that does allow leading zeroes... I was under the assumption that leading zeroes are disallowed for every single one of them (so far, this assumption hasn't been falsified)
Image
User avatar
elendiastarman
Posts: 410
Joined: Sat Dec 22, 2007 8:15 pm

Re: problem 055

Post by elendiastarman »

Lord_Farin wrote:
elendiastarman wrote: Leading zeros are not allowed in this case.
Please point to a PE problem that does allow leading zeroes... I was under the assumption that leading zeroes are disallowed for every single one of them (so far, this assumption hasn't been falsified)
Hmm...I seem to remember that there was just one problem that did...but I may be wrong. No big deal.
Want some
3.14159265358979323846264338327950288419716939937510
58209749445923078164062862089986280348253421170679...?
Image
Soabirw
Posts: 3
Joined: Sat Jan 22, 2011 11:29 pm

Re: problem 055

Post by Soabirw »

Running into some issues on this one. My code definitely generates palindromes and only increments the answer if one is found. I think I'm missing some exclusion rules though. I am excluding numbers with leading 0s. I.E. 10 + 01. I just skip 10. So basically all numbers that are a multiple of 10 gets skipped. Beyond that it looks like the vast majority of numbers will add up to a palindrome before hitting 50 iterations. Is there a lower bound? Should I not allow numbers like 1, 2, etc? They will create a palindrome before 50 iterations as well. What other exclusions might I be missing?
Soabirw
Posts: 3
Joined: Sat Jan 22, 2011 11:29 pm

Re: problem 055

Post by Soabirw »

Reading comprehension failure on my part. Read on wiki that Lychrel numbers are numbers that CAN'T be turned into palindromes. I read the description 10 times and kept thinking it meant Lychrels are numbers that can turn into palindromes. Leaving my silliness to hopefully be a warning to others.
browni3141
Posts: 18
Joined: Thu Jan 20, 2011 2:06 am

Re: problem 055

Post by browni3141 »

I think the wording should be changed to "How many probable Lychrel numbers are there below ten-thousand?"
If a number satisfies the conditions presented int the question then the number is a probable Lychrel number.
None are actually known to exist.
Image
harishkrishnapsbb
Posts: 1
Joined: Sun Jul 03, 2011 10:06 am

Re: problem 055

Post by harishkrishnapsbb »

When I output all the Lychrel Numbers less than 10000, numbers such as 89, 177 are displayed. I manually checked and found that at least till 10 iterations they don't yield a palindrome. Are they Lychrel numbers?
And did anyone else face this problem?
User avatar
jaap
Posts: 588
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: problem 055

Post by jaap »

harishkrishnapsbb wrote:... at least till 10 iterations they don't yield a palindrome.
The problem states that you should try 50 iterations, and that if that still doesn't give a palindrome then you may assume it is a Lychrel number. The numbers 89 and 177 do produce palindromes within 50 iterations (24 and 15 iterations respectively).
frogjg2003
Posts: 11
Joined: Thu Jul 14, 2011 2:37 pm

Re: problem 055

Post by frogjg2003 »

Are 2,4,6 and 8 considered palindromes?
Image
All with Phython.
TripleM
Posts: 384
Joined: Fri Sep 12, 2008 3:31 am

Re: problem 055

Post by TripleM »

Yes, they read the same back to front to me.
drwhat
Posts: 45
Joined: Tue Sep 06, 2011 4:56 am

Re: problem 055

Post by drwhat »

Just thought I'd post a few tips, as I got some confused and misleading ideas from reading previous posts. Also in case you think your algorithm is correct but still not getting the right answer, here are few reasons I had to fumble through.

1) Leading zeroes are not candidates for discarding a number if they occur from the flip process. For example, if 280 must be tested as 280 + 82 = 362 (thanks to rayfil for pointing out a big oops ), is a valid first step. There are in fact a few Lychrel numbers that are multiples of 10.

2) Initially Palindromic Numbers Can be Lychrel Hehe I know this is stated in the problems but I overlooked it.

3) Data types, Data Types, Data Types!! I ran into a few overflow problems even with 64bit variables. The numbers get suprisingly big for additions.
Last edited by drwhat on Fri Sep 09, 2011 12:41 pm, edited 1 time in total.
User avatar
rayfil
Administrator
Posts: 1412
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: problem 055

Post by rayfil »

For example, if 280 must be tested as 280 + 28 = 308, is a valid first step
WRONG. :(

280 + 082 = 362 would be a valid first step! :)
When you assume something, you risk being wrong half the time.
JMW1994
Posts: 43
Joined: Sat Apr 09, 2011 11:35 pm

Re: problem 055

Post by JMW1994 »

Do you have to reverse the number and add both the original and reversed number at least once before you can call the number palindromic if the initial number is palindromic?
Image
TripleM
Posts: 384
Joined: Fri Sep 12, 2008 3:31 am

Re: problem 055

Post by TripleM »

Did you see this line of the problem, which makes the answer very clear:
Surprisingly, there are palindromic numbers that are themselves Lychrel numbers; the first example is 4994.
Post Reply