Which integers n can be written as the difference of two palindromes?
arithmetic/digits/palindrome.differences New
New entry, edited from material collected for the archive and not yet in a released version.
Problem
Which integers n can be written as the difference of two palindromes? (Palindromes, not reversals.) [ Editor: reworded from the original: "What are the requirements on integer n so that there exists two palindromes with difference n? Note, palindromes, not reversals." ]
Show solution
[ Editor: The question was posed by Wei-Hwa Huang
<whuang@cco.caltech.edu>, who did not know the answer. Barry Wolk,
after posting some calculations, followed up: ]
After further work, my conclusion is: FORGET IT! Here's why:
Most numbers will be equal to the difference of two palindromes,
because of the formulas
(a, b, c, d) = (a, a+b-d, a+b-d, a) - ( , a-d, a+b-c-d, a-d)
(a, b, c, d, e) = (a, a+b-e, a+b+c-d-e, a+b-e, a)
- ( , a-e, a+b-d-e, a+b-d-e, a-e)
and similar formulas for vectors of other lengths. Note that these
involve vectors, not numbers.
Up to 10000, there are 506 numbers that are not equal to the
difference of two palindromes. Here are the first 100 of them:
1020 1029 1031 1038 1041 1047 1051 1061 1065 1071 1074 1081 1091 1101
1130 1131 1139 1141 1148 1151 1157 1161 1171 1175 1181 1191 1201 1202
1231 1240 1241 1249 1251 1258 1261 1267 1271 1281 1291 1301 1302 1314
1341 1350 1351 1359 1361 1368 1371 1377 1381 1391 1401 1402 1415 1424
1431 1451 1460 1461 1469 1471 1478 1481 1491 1501 1502 1516 1525 1531
1534 1541 1561 1570 1571 1579 1581 1591 1601 1602 1626 1631 1635 1641
1644 1651 1671 1680 1681 1691 1701 1702 1718 1731 1736 1741 1745 1751
1754 1761
Would anyone care to try to find a pattern among these numbers?
I also rashly suggested that base 2 (instead of base 10) could be
manageable. Well, at first the calculations indicated that there
might be a nice result here. However, as I pushed the calculations to
larger numbers, things became just as chaotic in base 2 as they were
in base 10 for smaller numbers. The answer for odd numbers is
trivial. Here are the first few even numbers that are not equal to
the difference of two 2-palindromes:
536 1730 1844 1892 2512
The only thing of interest that I see in base 2 is that there is only
one such number having 10 or fewer bits.
Finally, Dan Cass <dmc@fjsc.edu> [ Editor: "dmc@fjsc.edu (Dan Cass)"
in the original ] suggested that the definition of a
palindrome should say that 0 is not a palindrome. I feel this is
wrong, and David G Radcliffe <radcliff@alpha2.csd.uwm.edu> [ Editor:
"radcliff@alpha2.csd.uwm.edu (David G Radcliffe)" in the original ] also
assumed that 0 is a palindrome when he posted a proof of one of the
results I stated in my previous post. So it looks like Dan Cass is
outvoted, two to one. :-)
Seriously, if you use this definition of a palindrome, redoing the
calculations produces only trivial changes in the results. The above
list of 506 numbers becomes a list of 508 numbers, by adding the
numbers 919 and 9119 to the first list. The smallest number in the
list becomes 919 instead of 1020. [ Editor: "," in the original ] For B-palindromes with B>2, there
are similar changes.
Nice try, Wei-Hwa Huang, but the problem is apparently hopeless.
-- Barry Wolk <wolk@ccm.UManitoba.CA>