Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Every positive number is a sum of infinite palindromes since they include 0 as a palindrome. Try entering 101.


Why is that interesting? Limiting it to 3 makes it hard. If you allow an arbitrary amount then you can just represent the number in unary and call it a day.


It's easier to find more than fewer palindromes that when summed up will give a certain number. Finding just the three, is not that easy.


And just to clarify, the greedy algorithm (take the largest palindrome less than the number you're trying to express) doesn't work. To take a random nine-digit example (literally the first one I tried): 635932028 = 635929536 + 2442 + 44 + 6. In general you can express N as a sum of something like log(log(N)) palindromes this way, which is not quite constant.


101 is a palindrome so...

101=101+0+0


Why wouldn't 0 be a palindrome? Every single digit number is.


I think they're saying that 002 is counted as a palindrome, but 112 would not be.

(2 == 002 but 112 != 211 which is an "unfair" property of the number zero)


If 2 is not a palindrome, because if you prepend 0 it loses its palindrome properties, then no number is a palindrome. 121 cannot be a palindrome because 121 can also be written as 0121, and therefore it’s not a palindrome.

Further, there is nothing “unfair” about 0. It’s a real distinction. 002 is the same thing as 2. 112 is not the same thing as 2. So it’s not an unfair property. It’s a real distinction.


Right, that's why I put the word "unfair" in quotes; I wasn't sure how to rephrase the OP. Of course it is a real distinction, but I was trying to explain why other commenters weren't finding it impressive.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: