Page 1 of 1
Problem 145
Posted: Mon Apr 13, 2009 1:09 am
by Ran
Problem 145 (
View Problem)
"There are 120 reversible numbers below one-thousand."
Is this _really_ true? I've tried different solutions, but everytime I end up with 125

I even printed them all to a file, and sure, there are 125 numbers n in which all digits of n+reverse(n) is odd. Starting at 10+1=11 and ending with 948+849=1797.
Re: Problem 145
Posted: Mon Apr 13, 2009 1:18 am
by genious999
The reverse of '10' is '01' which a leading zero, and leading zeroes are not allowed. I would imagine the other 'extra' reverisble numbers you found also fall into that category, so check and see.
Re: Problem 145
Posted: Mon Apr 13, 2009 1:39 am
by Ran
genious999 wrote:The reverse of '10' is '01' which a leading zero, and leading zeroes are not allowed. I would imagine the other 'extra' reverisble numbers you found also fall into that category, so check and see.
So, if reverse(n) has a leading zero, n can't be a reversible number?
Re: Problem 145
Posted: Mon Apr 13, 2009 1:45 am
by genious999
No. It explicitly states in the text for the problem "Leading zeroes are not allowed in either n or reverse(n)."
Re: Problem 145
Posted: Mon Apr 13, 2009 1:53 am
by Ran
Hm, I thought something weird about "don't count the leading zeros", which I thought was weird since you usually don't add them...
Surely that could be misunderstood.
Thank you.
Re: Problem 145
Posted: Fri Feb 04, 2011 12:21 am
by franceq
must the sums be distincts...?? becouse I saw 9999999 mabe 100 times....

DD
Re: Problem 145
Posted: Fri Feb 04, 2011 3:38 am
by rayfil
Nothing in the problem description specifies that sums must be distinct.
Re: Problem 145
Posted: Fri Feb 04, 2011 10:31 am
by franceq
Oukej thats very good .-)
Re: Problem 145
Posted: Sun May 08, 2011 5:07 pm
by xe3tec
that problem made my lifespan sink by factor 2 x_x
unbelievable...
Re: Problem 145
Posted: Sat Sep 10, 2011 1:55 am
by RichardBuckalew
The problem description is indeed confusing. I assumed that 'leading zeros are not allowed' meant 'remove leading zeros before performing the addition'
For the sake of others who come after us, please fix this!
Re: Problem 145
Posted: Sat Sep 10, 2011 8:28 am
by Lord_Farin
RichardBuckalew wrote:'remove leading zeros before performing the addition'
Could you explain what difference this could possibly make? Last time I checked, I could calculate 120+21=141=120+021.
Re: Problem 145
Posted: Mon Sep 12, 2011 6:33 am
by drwhat
While taking the quote: "Leading zeroes are not allowed in either n or reverse(n)." to mean that you should strip of leading zeroes does result in tautology in the original problem, there is nothing to say the writer of the problem didn't include one. At first reading I also assumed that is what the line meant, rather than "Any n, or reverse(n) containing leading zeroes should be excluded from the answer." Which I think much more clearly expresses the intent of the line.
Tony
Re: Problem 145
Posted: Fri Sep 30, 2011 3:53 am
by JMW1994
I've written my program but should it take days to get to the answer?
Absolutely not! Each problem has been designed according to a "one-minute rule", which means that although it may take several hours to design a successful algorithm with more difficult problems, an efficient implementation will allow a solution to be obtained on a modestly powered computer in less than one minute.
I got an algorithm to correctly solve the example and possibly the actual problem itself, but is there a clever method to solve this one in about a minute? Project Euler's about clearly says that all answers can be approached within one minute.
I already wrote the functions in a header file(I use C) that deal with storing and reversing numbers, rotating numbers, and checking whether the digits is odd and even, so that I don't have to rewrite the functions required to solve the problems over again.
Re: Problem 145
Posted: Fri Sep 30, 2011 6:40 am
by jaap
JMW1994 wrote:I got an algorithm to correctly solve the example and possibly the actual problem itself, but is there a clever method to solve this one in about a minute?
My program takes less than a millisecond.
Re: Problem 145
Posted: Mon Oct 10, 2011 2:09 pm
by Fogmeister
LOL, I'm stuck in the same place as JMW.
I have an algorithm that gives the correct answer for the example in 24ms (using a very sow language).
However, if I have calculated the O of the algorithm correctly it will take about an hour and a half to solve for upto 999999999.
Oh well...

Re: Problem 145
Posted: Thu Mar 08, 2012 3:03 pm
by jamel12
Hi everybody,
Can someone confirm me that below 100 there is 36 reversible numbers and under 300 there is 99 numbers
Thank you
Re: Problem 145
Posted: Thu Mar 08, 2012 3:32 pm
by thundre
No, Jamel, those counts are too high. You must be counting some that don't meet the problem's requirements.
Re: Problem 145
Posted: Wed Aug 22, 2012 4:38 pm
by Shroots
The problem says that leading zeros are not allowed but I don't think that it's clear how to treat numbers ending in zeros. Should they be completely discarded since reverse(n) would contain leading zeros? Or should the leading zeros in reverse(n) be trimmed? And if so then which digits would correspond to eachother in n and reverse(n)?
Re: Problem 145
Posted: Wed Aug 22, 2012 4:50 pm
by TheEvil
Shroots wrote:The problem says that leading zeros are not allowed but I don't think that it's clear how to treat numbers ending in zeros. Should they be completely discarded since reverse(n) would contain leading zeros? Or should the leading zeros in reverse(n) be trimmed? And if so then which digits would correspond to eachother in n and reverse(n)?
From the description of the problem: "Leading zeroes are not allowed in either n or reverse(n).". So neither n nor reverse(n) can end with zero.