Three Is The Key

If The Roses of Heliogabalus (1888) is any guide, Sir Lawrence Alma-Tadema (1836-1912) thought that 222 is a special number. But his painting doesn’t exhaust its secrets. To get to another curiosity of 222, start with 142857. As David Wells puts it in his Penguin Dictionary of Curious and Interesting Numbers (1986), 142857 is a “number beloved of all recreational mathematicians”. He then describes some of its properties, including this:

142857 x 1 = 142857
142857 x 2 = 285714
142857 x 3 = 428571
142857 x 4 = 571428
142857 x 5 = 714285
142857 x 6 = 857142

The multiples are cyclic permutations: the order of the six numbers doesn’t change, only their starting point. Because each row contains the same numbers, it sums to the same total: 1 + 4 + 2 + 8 + 5 + 7 = 27. And because each row begins with a different number, each column contains the same six numbers and also sums to 27, like this:

1 4 2 8 5 7
+ + + + + +
2 8 5 7 1 4
+ + + + + +
4 2 8 5 7 1
+ + + + + +
5 7 1 4 2 8
+ + + + + +
7 1 4 2 8 5
+ + + + + +
8 5 7 1 4 2

= = = = = =

2 2 2 2 2 2
7 7 7 7 7 7

If the diagonals of the square also summed to the same total, the multiples of 142857 would create a full magic square. But the diagonals don’t have the same total: the left-right diagonal sums to 31 and the right-left to 23 (note that 31 + 23 = 54 = 27 x 2).

But where does 142857 come from? It’s actually the first six digits of the reciprocal of 7, i.e. 1/7 = 0·142857… Those six numbers repeat for ever, because 1/7 is a prime reciprocal with maximum period: when you calculate 1/7, all integers below 7 are represented in the remainders. The square of multiples above is simply another way of representing this:

1/7 = 0·142857…
2/7 = 0·285714…
3/7 = 0·428571…
4/7 = 0·571428…
5/7 = 0·714285…
6/7 = 0·857142…
7/7 = 0·999999…

The prime reciprocals 1/17 and 1/19 also have maximum period, so the squares created by their multiples have the same property: each row and each column sums to the same total, 72 and 81, respectively. But the 1/19 square has an additional property: both diagonals sum to 81, so it is fully magic:

01/19 = 0·0 5 2 6 3 1 5 7 8 9 4 7 3 6 8 4 2 1
02/19 = 0·1 0 5 2 6 3 1 5 7 8 9 4 7 3 6 8 4 2…
03/19 = 0·1 5 7 8 9 4 7 3 6 8 4 2 1 0 5 2 6 3…
04/19 = 0·2 1 0 5 2 6 3 1 5 7 8 9 4 7 3 6 8 4…
05/19 = 0·2 6 3 1 5 7 8 9 4 7 3 6 8 4 2 1 0 5…
06/19 = 0·3 1 5 7 8 9 4 7 3 6 8 4 2 1 0 5 2 6…
07/19 = 0·3 6 8 4 2 1 0 5 2 6 3 1 5 7 8 9 4 7…
08/19 = 0·4 2 1 0 5 2 6 3 1 5 7 8 9 4 7 3 6 8…
09/19 = 0·4 7 3 6 8 4 2 1 0 5 2 6 3 1 5 7 8 9…
10/19 = 0·5 2 6 3 1 5 7 8 9 4 7 3 6 8 4 2 1 0…
11/19 = 0·5 7 8 9 4 7 3 6 8 4 2 1 0 5 2 6 3 1…
12/19 = 0·6 3 1 5 7 8 9 4 7 3 6 8 4 2 1 0 5 2…
13/19 = 0·6 8 4 2 1 0 5 2 6 3 1 5 7 8 9 4 7 3…
14/19 = 0·7 3 6 8 4 2 1 0 5 2 6 3 1 5 7 8 9 4…
15/19 = 0·7 8 9 4 7 3 6 8 4 2 1 0 5 2 6 3 1 5…
16/19 = 0·8 4 2 1 0 5 2 6 3 1 5 7 8 9 4 7 3 6…
17/19 = 0·8 9 4 7 3 6 8 4 2 1 0 5 2 6 3 1 5 7…
18/19 = 0·9 4 7 3 6 8 4 2 1 0 5 2 6 3 1 5 7 8

First line = 0 + 5 + 2 + 6 + 3 + 1 + 5 + 7 + 8 + 9 + 4 + 7 + 3 + 6 + 8 + 4 + 2 + 1 = 81

Left-right diagonal = 0 + 0 + 7 + 5 + 5 + 9 + 0 + 3 + 0 + 4 + 2 + 8 + 7 + 5 + 6 + 7 + 5 + 8 = 81

Right-left diagonal = 9 + 9 + 2 + 4 + 4 + 0 + 9 + 6 + 9 + 5 + 7 + 1 + 2 + 4 + 3 + 2 + 4 + 1 = 81

In base 10, this doesn’t happen again until the 1/383 square, whose magic total is 1719 (= 383-1 x 10-1 / 2). But recreational maths isn’t restricted to base 10 and lots more magic squares are created by lots more primes in lots more bases. The prime 223 in base 3 is one of them. Here the first line is

1/223 = 1/220213 = 0·

0000100210210102121211101202221112202
2110211112001012200122102202002122220
2110110201020210001211000222011010010
2222122012012120101011121020001110020
0112011110221210022100120020220100002
0112112021202012221011222000211212212…

The digits sum to 222, so 222 is the magic total for all rows and columns of the 1/223 square. It is also the total for both diagonals, so the square is fully magic. I doubt that Alma-Tadema knew this, because he lived before computers made calculations like that fast and easy. But he was probably a Freemason and, if so, would have been pleased to learn that 222 had a link with squares.

Summer-Climb Views

Simple things can sometimes baffle advanced minds. If you take a number, reverse its digits, add the result to the original number, then repeat all that, will you eventually get a palindrome? (I.e., a number, like 343 or 27172, that reads the same in both directions.) Many numbers do seem to produce palindromes sooner or later. Here are 195 and 197:

195 + 591 = 786 + 687 = 1473 + 3741 = 5214 + 4125 = 9339 (4 steps)

197 + 791 = 988 + 889 = 1877 + 7781 = 9658 + 8569 = 18227 + 72281 = 90508 + 80509 = 171017 + 710171 = 881188 (7 steps)

But what about 196? Well, it starts like this:

196 + 691 = 887 + 788 = 1675 + 5761 = 7436 + 6347 = 13783 + 38731 = 52514 + 41525 = 94039 + 93049 = 187088 + 880781 = 1067869 + 9687601 = 10755470 + 7455701 = 18211171 + 17111281 = 35322452 + 25422353 = 60744805 + 50844706 = 111589511 + 115985111 = 227574622 + 226475722 = 454050344 + 443050454 = 897100798 + 897001798 = 1794102596 + 6952014971 = 8746117567 + 7657116478 = 16403234045 + 54043230461 = 70446464506 + 60546464407 = 130992928913 + 319829299031 = 450822227944 + 449722228054 = 900544455998…

And so far, after literally years of computing by mathematicians, it hasn’t produced a palindrome. It seems very unlikely it ever will, but no-one can prove this and say that 196 is, in base 10, a Lychrel number, or a number that never produces a palindrome. In other words, a simple thing has baffled advanced minds.

I don’t know whether it can baffle advanced minds, but here’s another simple mathematical technique: sum all the digits of a number, then add the result to the original number and repeat. How long before a palindrome appears in this case? Sum it and see:

10 + 1 = 11

12 + 3 = 15 + 6 = 21 + 3 = 24 + 6 = 30 + 3 = 33 (5 steps)

13 + 4 = 17 + 8 = 25 + 7 = 32 + 5 = 37 + 10 = 47 + 11 = 58 + 13 = 71 + 8 = 79 + 16 = 95 + 14 = 109 + 10 = 119 + 11 = 130 + 4 = 134 + 8 = 142 + 7 = 149 + 14 = 163 + 10 = 173 + 11 = 184 + 13 = 197 + 17 = 214 + 7 = 221 + 5 = 226 + 10 = 236 + 11 = 247 + 13 = 260 + 8 = 268 + 16 = 284 + 14 = 298 + 19 = 317 + 11 = 328 + 13 = 341 + 8 = 349 + 16 = 365 + 14 = 379 + 19 = 398 + 20 = 418 + 13 = 431 + 8 = 439 + 16 = 455 + 14 = 469 + 19 = 488 + 20 = 508 + 13 = 521 + 8 = 529 + 16 = 545 (45 steps)

14 + 5 = 19 + 10 = 29 + 11 = 40 + 4 = 44 (4 steps)

15 + 6 = 21 + 3 = 24 + 6 = 30 + 3 = 33 (4 steps)

16 + 7 = 23 + 5 = 28 + 10 = 38 + 11 = 49 + 13 = 62 + 8 = 70 + 7 = 77 (7 steps)

17 + 8 = 25 + 7 = 32 + 5 = 37 + 10 = 47 + 11 = 58 + 13 = 71 + 8 = 79 + 16 = 95 + 14 = 109 + 10 = 119 + 11 = 130 + 4 = 134 + 8 = 142 + 7 = 149 + 14 = 163 + 10 = 173 + 11 = 184 + 13 = 197 + 17 = 214 + 7 = 221 + 5 = 226 + 10 = 236 + 11 = 247 + 13 = 260 + 8 = 268 + 16 = 284 + 14 = 298 + 19 = 317 + 11 = 328 + 13 = 341 + 8 = 349 + 16 = 365 + 14 = 379 + 19 = 398 + 20 = 418 + 13 = 431 + 8 = 439 + 16 = 455 + 14 = 469 + 19 = 488 + 20 = 508 + 13 = 521 + 8 = 529 + 16 = 545 (44 steps)

18 + 9 = 27 + 9 = 36 + 9 = 45 + 9 = 54 + 9 = 63 + 9 = 72 + 9 = 81 + 9 = 90 + 9 = 99 (9 steps)

19 + 10 = 29 + 11 = 40 + 4 = 44 (3 steps)

20 + 2 = 22

I haven’t looked very thoroughly at this technique, so I don’t know whether it throws up a seemingly unpalindromizable number. If it does, I don’t have an advanced mind, so I won’t be able to prove that it is unpalindromizable. But an adaptation of the technique produces something interesting when it is represented on a graph. This time, if s > 9, where s = digit-sum(n), let s = digit-sum(s) until s <= 9 (i.e, s < 10, the base). I call this the condensed digit-sum:

140 + 5 = 145 + 1 = 146 + 2 = 148 + 4 = 152 + 8 = 160 + 7 = 167 + 5 = 172 + 1 = 173 + 2 = 175 + 4 = 179 + 8 = 187 + 7 = 194 + 5 = 199 + 1 = 200 + 2 = 202 (15 steps)

Here, for comparison, is the sequence for 140 using uncondensed digit-sums:

140 + 5 = 145 + 10 = 155 + 11 = 166 + 13 = 179 + 17 = 196 + 16 = 212 (6 steps)

When all the numbers (including palindromes) created using condensed digit-sums are shown on a graph, they create an interesting pattern in base 10 (the x-axis represents n, the y-axis represents n, n1 = n + digit-sum(n), n2 = n1 + digit-sum(n1), etc):

(Please open images in a new window if they fail to animate.)

digitsum_b10

condensed_b3_to_b20_etc

And here, for comparison, are the patterns created by uncondensed digit-sums in base 2 to 10:

uncondensed_b2_to_b10

Watch this Sbase

In standard notation, there are two ways to represent 2: 10, in base 2, and 2 in every other base. Accordingly, there are three ways to represent 3: 11 in base 2, 10 in base 3, and 3 in every other base. There are four ways to represent 4, five ways to represent 5, and so on. Now, suppose you sum all the digits of all the representations of n in the bases 2 to n, like this:

Σ(2) = 1+02 = 1
Σ(3) = 1+12 + 1+03 = 3 (+2)
Σ(4) = 1+0+02 + 1+13 + 1+04 = 4 (+1)
Σ(5) = 1+0+12 + 1+23 + 1+14 + 1+05 = 8 (+4)
Σ(6) = 1+1+02 + 2+03 + 1+24 + 1+15 + 1+06 = 10 (+2)
Σ(7) = 1+1+12 + 2+13 + 1+34 + 1+25 + 1+16 + 1+07 = 16 (+6)
Σ(8) = 1+0+0+02 + 2+23 + 2+04 + 1+35 + 1+26 + 1+17 + 1+08 = 17 (+1)
Σ(9) = 1+0+0+12 + 1+0+03 + 2+14 + 1+45 + 1+36 + 1+27 + 1+18 + 1+09 = 21 (+4)
Σ(10) = 1+0+1+02 + 1+0+13 + 2+24 + 2+05 + 1+46 + 1+37 + 1+28 + 1+19 + 1+010 = 25 (+4)

It seems reasonable to suppose that as n increases, so the all-digit-sum of n increases. But that isn’t always the case: occasionally it decreases. Here are the sums for n=11..100 (with prime factors when the sum is composite):

Σ(11) = 35 = 5·7 (+10)
Σ(12) = 34 = 2·17 (-1)
Σ(13) = 46 = 2·23 (+12)
Σ(14) = 52 = 22·13 (+6)
Σ(15) = 60 = 22·3·5 (+8)
Σ(16) = 58 = 2·29 (-2)
Σ(17) = 74 = 2·37 (+16)
Σ(18) = 73 (-1)
Σ(19) = 91 = 7·13 (+18)
Σ(20) = 92 = 22·23 (+1)
Σ(21) = 104 = 23·13 (+12)
Σ(22) = 114 = 2·3·19 (+10)
Σ(23) = 136 = 23·17 (+22)
Σ(24) = 128 = 27 (-8)
Σ(25) = 144 = 24·32 (+16)
Σ(26) = 156 = 22·3·13 (+12)
Σ(27) = 168 = 23·3·7 (+12)
Σ(28) = 171 = 32·19 (+3)
Σ(29) = 199 (+28)
Σ(30) = 193 (-6)
Σ(31) = 223 (+30)
Σ(32) = 221 = 13·17 (-2)
Σ(33) = 241 (+20)
Σ(34) = 257 (+16)
Σ(35) = 281 (+24)
Σ(36) = 261 = 32·29 (-20)
Σ(37) = 297 = 33·11 (+36)
Σ(38) = 315 = 32·5·7 (+18)
Σ(39) = 339 = 3·113 (+24)
Σ(40) = 333 = 32·37 (-6)
Σ(41) = 373 (+40)
Σ(42) = 367 (-6)
Σ(43) = 409 (+42)
Σ(44) = 416 = 25·13 (+7)
Σ(45) = 430 = 2·5·43 (+14)
Σ(46) = 452 = 22·113 (+22)
Σ(47) = 498 = 2·3·83 (+46)
Σ(48) = 472 = 23·59 (-26)
Σ(49) = 508 = 22·127 (+36)
Σ(50) = 515 = 5·103 (+7)
Σ(51) = 547 (+32)
Σ(52) = 556 = 22·139 (+9)
Σ(53) = 608 = 25·19 (+52)
Σ(54) = 598 = 2·13·23 (-10)
Σ(55) = 638 = 2·11·29 (+40)
Σ(56) = 634 = 2·317 (-4)
Σ(57) = 670 = 2·5·67 (+36)
Σ(58) = 698 = 2·349 (+28)
Σ(59) = 756 = 22·33·7 (+58)
Σ(60) = 717 = 3·239 (-39)
Σ(61) = 777 = 3·7·37 (+60)
Σ(62) = 807 = 3·269 (+30)
Σ(63) = 831 = 3·277 (+24)
Σ(64) = 819 = 32·7·13 (-12)
Σ(65) = 867 = 3·172 (+48)
Σ(66) = 861 = 3·7·41 (-6)
Σ(67) = 927 = 32·103 (+66)
Σ(68) = 940 = 22·5·47 (+13)
Σ(69) = 984 = 23·3·41 (+44)
Σ(70) = 986 = 2·17·29 (+2)
Σ(71) = 1056 = 25·3·11 (+70)
Σ(72) = 1006 = 2·503 (-50)
Σ(73) = 1078 = 2·72·11 (+72)
Σ(74) = 1114 = 2·557 (+36)
Σ(75) = 1140 = 22·3·5·19 (+26)
Σ(76) = 1155 = 3·5·7·11 (+15)
Σ(77) = 1215 = 35·5 (+60)
Σ(78) = 1209 = 3·13·31 (-6)
Σ(79) = 1287 = 32·11·13 (+78)
Σ(80) = 1263 = 3·421 (-24)
Σ(81) = 1293 = 3·431 (+30)
Σ(82) = 1333 = 31·43 (+40)
Σ(83) = 1415 = 5·283 (+82)
Σ(84) = 1368 = 23·32·19 (-47)
Σ(85) = 1432 = 23·179 (+64)
Σ(86) = 1474 = 2·11·67 (+42)
Σ(87) = 1530 = 2·32·5·17 (+56)
Σ(88) = 1530 = 2·32·5·17 (=)
Σ(89) = 1618 = 2·809 (+88)
Σ(90) = 1572 = 22·3·131 (-46)
Σ(91) = 1644 = 22·3·137 (+72)
Σ(92) = 1663 (+19)
Σ(93) = 1723 (+60)
Σ(94) = 1769 = 29·61 (+46)
Σ(95) = 1841 = 7·263 (+72)
Σ(96) = 1784 = 23·223 (-57)
Σ(97) = 1880 = 23·5·47 (+96)
Σ(98) = 1903 = 11·173 (+23)
Σ(99) = 1947 = 3·11·59 (+44)
Σ(100) = 1923 = 3·641 (-24)

The sum usually increases, occasionally decreases. In one case, when 87 = n = 88, it stays the same. This also happens when 463 = n = 464, where Σ(463) = Σ(464) = 39,375. Does it happen again? I don’t know. The ratio of sum-ups to sum-downs seems to tend towards 3:1. Is that the exact ratio at infinity? I don’t know. Watch this sbase.

Back to Bases

(N.B. I am not a mathematician and often make stupid mistakes in my recreational maths. Caveat lector.)

101 isn’t a number, it’s a label for a number. In fact, it’s a label for infinitely many numbers. In base 2, 1012 = 5; in base 3, 1013 = 10; 1014 = 17; 1015 = 26; and so on, for ever. In some bases, like 2 and 4, the number labelled 101 is prime. In other bases, it isn’t. But it is always a palindrome: that is, it’s the same read forward and back. But 101, the number itself, is a palindrome in only two bases: base 10 and base 100.1 Note that 100 = 101-1: with the exception of 2, all integers, or whole numbers, are palindromic in at least one base, the base that is one less than the integer itself. So 3 = 112; 4 = 113; 5 = 114; 101 = 11100; and so on.

Less trivial is the question of which integers set progressive records for palindromicity, or for the number of palindromes they create in bases less than the integers themselves. You might guess that the bigger the integer, the more palindromes it will create, but it isn’t as simple as that. Here is 10 represented in bases 2 through 9:

10102 | 1013* | 224* | 205 | 146 | 137 | 128 | 119*

10 is a palindrome in bases 3, 4, and 9. Now here is 30 represented in bases 2 through 29 (note that a number between square brackets represents a single digit in that base):2

111102 | 10103 | 1324 | 1105 | 506 | 427 | 368 | 339* | 30 | 2811 | 2612 | 2413 | 2214* | 2015 | 1[14]16 | 1[13]17 | 1[12]18 | 1[11]19 | 1[10]20 | 1921 | 1822 | 1723 | 1624 | 1525 | 1426 | 1327 | 1228
| 1129*

30, despite being three times bigger than 10, creates only three palindromes too: in bases 9, 14, and 29. Here is a graph showing the number of palindromes for each number from 3 to 100 (prime numbers are in red):

Graph of palindromes in various bases for n=3 to 100

The number of palindromes a number has is related to the number of factors, or divisors, it has. A prime number has only one factor,  itself (and 1), so primes tend to be less palindromic than composite numbers. Even large primes can have only one palindrome, in the base b=n-1 (55,440 has 119 factors and 61 palindromes; 65,381 has one factor and one palindrome, 1165380). Here is a graph showing the number of factors for each number from 3 to 100:

Graph of number of factors for n = 3 to 100

And here is an animated gif combining the two previous images:

Animated gif of number of palindromes and factors, n=3 to 100

Here is a graph indicating where palindromes appear when n, along the x-axis, is represented in the bases b=2 to n-1, along the y-axis:

Graph showing where palindromes occur in various bases for n = 3 to 1000

The red line are the palindromes in base b=n-1, which is “11” for every n>2. The lines below it arise because every sufficiently large n with divisor d can be represented in the form d·n1 + d. For example, 8 = 2·3 + 2, so 8 in base 3 = 223; 18 = 3·5 + 3, so 18 = 335; 32 = 4.7 + 4, so 32 = 447; 391 = 17·22 + 17, so 391 = [17][17]22.

And here, finally, is a table showing integers that set progressive records for palindromicity (p = number of palindromes, f = total number of factors, prime and non-prime):

n Prime Factors p f    n Prime Factors p f
3 3 1 1    2,520 23·32·5·7 25 47
5 5 2 1    3,600 24·32·52 26 44
10 2·5 3 3    5,040 24·32·5·7 30 59
21 3·7 4 3    7,560 23·33·5·7 32 63
36 22·32 5 8    9,240 23·3·5·7·11 35 63
60 22·3·5 6 11    10,080 25·32·5·7 36 71
80 24·5 7 9    12,600 23·32·52·7 38 71
120 23·3·5 8 15    15,120 24·33·5·7 40 79
180 22·32·5 9 17    18,480 24·3·5·7·11 43 79
252 22·32·7 11 17    25,200 24·32·52·7 47 89
300 22·3·52 13 17    27,720 23·32·5·7·11 49 95
720 24·32·5 16 29    36,960 25·3·5·7·11 50 95
1,080 23·33·5 17 31    41,580 22·33·5·7·11 51 95
1,440 25·32·5 18 35    45,360 24·34·5·7 52 99
1,680 24·3·5·7 20 39    50,400 25·32·52·7 54 107
2,160 24·33·5 21 39    55,440 24·32·5·7·11 61 119

Notes

1. That is, it’s only a palindrome in two bases less than 101. In higher bases, “101” is a single digit, so is trivially a palindrome (as the numbers 1 through 9 are in base 10).

2. In base b, there are b digits, including 0. So base 2 has two digits, 0 and 1; base 10 has ten digits, 0-9; base 16 has sixteen digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.