Tuesday, 23 November 2021

Numbers As Sums Of Palindromes

I've written about palindromes before in a variety of posts (just type palindromes into the search box for this site) but thus far I've not mentioned the representation of numbers as a sum of palindromes. Figure 1 shows a screenshot of a tweet from Cliff Pickover's Twitter feed:


Figure 1

I came across this tweet not long ago and immediately wrote a program (permalink) in SageMathCell to determine what these palindromic sums were for any given number. Below is the calculation box.


It turns out that for 26532, my diurnal age today, there are 193 different way to represent it as a sum of three palindromes. Here are examples of just a few of them:
  • 11 + 969 +25552
  • 414 + 7337 + 18781
  • 979 + 1111 + 24442
  • 5885 + 6006 + 14641
Most numbers, about 92%, can in fact be represented as a sum of two palindromes in one or more ways. However, 26532 is amongst the 8% minority that cannot. The numbers on either side of it however, can be represented as a sum of two palindromes. The program above can be easily modified to find these palindromes, just replace C = Combinations(P, 3) with C = Combinations(P, 2). Here are the results:
  • 26531 = 979 + 25552
  • 26533 = 171 + 26362 = 1991 + 24542
Between 26500 and 27000, the numbers that cannot be represented as a sum of two palindromes are:
26502, 26512, 26522, 26532, 26542, 26572, 26582, 26592, 26602, 26612, 26622, 26632, 26642, 26672, 26682, 26692, 26702, 26712, 26722, 26732, 26742, 26772, 26782, 26792, 26802, 26812, 26822, 26832, 26842, 26872, 26882, 26892, 26902, 26912, 26922, 26932, 26942, 26952, 26972, 26982, 26992
There are 41 such numbers representing 8.20% of the total of 500 numbers. It can be noted that all the numbers in this range are even and all end in 2. This pattern seems to repeat for other ranges. 

That's about it, a simple yet interesting property that divides numbers into two categories: those that can be represented as a sum of two palindromes and those that cannot. 

No comments:

Post a Comment