Algorithms are a bad way to show that something doesn’t exist. You tested up to n? Maybe the first counterexample is n + 1.
If you could write such a palindrome, you could write a shorter palindrome by taking off the first and last digits, and so on and so forth. This is not enough in and of itself to cause a problem, but could lead to something interesting down the line.
If you’re allowed to start from 0, you can do it in binary: 0, 1, and 10 make 0110, a palindrome. I can’t find one in base 3, but I didn’t try for very long.
Might also be interesting to see how this works outside of positive integer bases–what about the Cantor or Fibonacci representations?
Let me trot out my Turing machine T[subscript]q[/subscript] which is designed for this and I’ll let you know when it halts on this particular question…
And to show that N can’t be anything other than those 9 values, try anything else, again remembering that the digits must be in descending order which really limits the values of N that you have to look at…
N=10987654321
Fails by inspection, just read it backwards and you’re hosed when you hit the 0. And since any higher value of N (1110987654321 for example) still contains 10987654321, which we know fails the palindrome test, you are stuck with the original 9 possible values of N.
My example on the “expansion” was wrong, N=1101987654321 would be a possibility (read backwards you get 1234567891011).
However so far as I can see (no, not a cast-iron proof) all the sequences will break down at a point: N has J digits in it, and the (J+1)th digit from the end must be a 0 (since N ends with 1, the number right before it ends with 0), and that 0 still hoses the sequence.
Certainly, however I was looking at the “backwards view”, checking the end of the sequence in reverse to see whether it can possibly stay in ascending order.
Math Olympiad? OK, now I don’t feel so bad about messing it up
(And please tell me if it’s uncool to “think out loud” in a GQ math puzzle)
The number of digits in N (call it J) is far smaller than the number of digits in the written sequence 123…(N-2)(N-1)(N).
For example with N=21, J=2 (digits) and when you write it out you get 33 digits (call that K). Wtih N=321, J=3 and K=425 (quickie calc, I may be off but it’s still way bigger than J is).
If we can show that the end of the sequence goes into a pattern not found at the beginning of the sequence we’re in good position to show that the total sequence is not a palindrome.
Pick an abitrary N. It ends in 1 for reasons previously shown. Thus the (J+1)th digit from the end of the sequence must be a 0. Example:
N=654321 (J=6)
End of the sequence is …654320654321 and the 7th digit from the end is a 0.
After this the sequence immediately starts back into ascending order from 2 on up.
Here’s where it gets fun; I can SEE what I need to prove but I’m missing that one little key bit. The rough line of reasoning is that because the J digits from the back end are all in sequence, and J is so much smaller than K, this interruption in the sequence (where we hit 0 and then start counting upwards again at 2, 3, 4…) occurs nowhere near the middle of the overall sequence. The middle of the sequence, where the increasing and decreasing sets of numbers smack into each other, is the only place where you can possibly find that interruption, correct?
So that’s where I am now. Can anyone follow this line of reasoning? How best to administer the coup de grace?
Suppose that the list 1,2,3,…,N produces a palindrome P when the commas are removed. Let 10^m be the largest power of 10 less than or equal to N (we can know that m >= 2 by explicitly checking a finite number of examples). Then the string of m 0’s in the decimal expansion of 10^m can be the only string of m zeros in P. Therefore, it must be in the center of P. But this string of m zeros will be immediately preceeded by the digits 9 1 (from the 9 at the end of 10^m - 1 and the 1 at the beginning of 10^m) and immediately followed by the digits 1 0 (from the digits at the beginning of 10^m + 1). Since 9 1 is not 1 0 in reverse, P cannot be a palindrome. QED