3 ms·
Every positive number is a sum of infinite palindromes since they include 0 as a palindrome. Try entering 101.
by et2o 8y ago
Every positive number is a sum of infinite palindromes since they include 0 as a palindrome. Try entering 101.
- jarfil 8y agoIt'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.
- madcaptenor 8y agoAnd 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.
- yiyus 8y agoWhy wouldn't 0 be a palindrome? Every single digit number is.
- ReverseCold 8y agoI 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)
- addicted 8y agoIf 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.
- ReverseCold 8y agoRight, 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.
- deleted 8y ago[deleted]
- mikeash 8y agoWhy 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.
- tantalor 8y ago101 is a palindrome so... 101=101+0+0