Reverssum

Here’s a simple sequence. What’s the next number?

1, 2, 4, 8, 16, 68, 100, ?

The rule I’m using is this: Reverse the number, then add the sum of the digits. So 1 doubles till it becomes 16. Then 16 becomes 61 + 6 + 1 = 68. Then 68 becomes 86 + 8 + 6 = 100. Then 100 becomes 001 + 1 = 2. And the sequence falls into a loop.

Reversing the number means that small numbers can get big and big numbers can get small, but the second tendency is stronger for the first few seeds:

• 1 → 2 → 4 → 8 → 16 → 68 → 100 → 2
• 2 → 4 → 8 → 16 → 68 → 100 → 2
• 3 → 6 → 12 → 24 → 48 → 96 → 84 → 60 → 12
• 4 → 8 → 16 → 68 → 100 → 2 → 4
• 5 → 10 → 2 → 4 → 8 → 16 → 68 → 100 → 2
• 6 → 12 → 24 → 48 → 96 → 84 → 60 → 12
• 7 → 14 → 46 → 74 → 58 → 98 → 106 → 608 → 820 → 38 → 94 → 62 → 34 → 50 → 10 → 2 → 4 → 8 → 16 → 68 → 100 → 2
• 8 → 16 → 68 → 100 → 2 → 4 → 8
• 9 → 18 → 90 → 18
• 10 → 2 → 4 → 8 → 16 → 68 → 100 → 2

An 11-seed is a little more interesting:

11 → 13 → 35 → 61 → 23 → 37 → 83 → 49 → 107 → 709 → 923 → 343 → 353 → 364 → 476 → 691 → 212 → 217 → 722 → 238 → 845 → 565 → 581 → 199 → 1010 → 103 → 305 → 511 → 122 → 226 → 632 → 247 → 755 → 574 → 491 → 208 → 812 → 229 → 935 → 556 → 671 → 190 → 101 → 103 (11 leads to an 18-loop from 103 at step 26; total steps = 44)

Now try some higher bases:

• 1 → 2 → 4 → 8 → 15 → 57 → 86 → 80 → 15 (base=11)
• 1 → 2 → 4 → 8 → 14 → 46 → 72 → 34 → 4A → B6 → 84 → 58 → 96 → 80 → 14 (base=12)
• 1 → 2 → 4 → 8 → 13 → 35 → 5B → C8 → A6 → 80 → 13 (base=13)
• 1 → 2 → 4 → 8 → 12 → 24 → 48 → 92 → 36 → 6C → DA → C8 → A4 → 5A → B6 → 80 → 12 (base=14)
• 1 → 2 → 4 → 8 → 11 → 13 → 35 → 5B → C6 → 80 → 11 (base=15)
• 1 → 2 → 4 → 8 → 10 → 2 (base=16)

Does the 1-seed always create a short sequence? No, it gets pretty long in base-19 and base-20:

• 1 → 2 → 4 → 8 → [16] → 1D → DF → [17]3 → 4[18] → 107 → 709 → 914 → 424 → 42E → E35 → 54[17] → [17]5C → C7D → D96 → 6B3 → 3C7 → 7D6 → 6EE → E[16]2 → 2[18]8 → 90B → B1A → A2E → E3[17] → [17]5A → A7B → B90 → AC→ DD → F1 → 2C → C[16] → [18]2 → 40 → 8 (base=19)
• 1 → 2 → 4 → 8 → [16] → 1C → CE → F[18] → 108 → 80A → A16 → 627 → 731 → 13[18] → [18]43 → 363 → 36F → F77 → 794 → 4A7 → 7B5 → 5CA → ADC → CF5 → 5[17]4 → 4[18]B → B[19][17] → [18]1[18] → [18]3F → F5E → E79 → 994 → 4AB → BB9 → 9D2 → 2ED → DFB → B[17]C → C[19]B → C1E → E2[19] → [19]49 → 96B → B7F → F94 → 4B3 → 3C2 → 2D0 → D[17] → [19]3 → 51 → 1B → BD → EF → [17]3 → 4[17] → [18]5 → 71 → 1F → F[17] → [19]7 → 95 → 63 → 3F → [16]1 → 2D → D[17] (base=20)

Then it settles down again:

• 1 → 2 → 4 → 8 → [16] → 1B → BD → EE → [16]0 → 1B (base=21)
• 1 → 2 → 4 → 8 → [16] → 1A → AC → DA → BE → FE → [16]0 → 1A (base=22)
• 1 → 2 → 4 → 8 → [16] → 19 → 9B → C6 → 77 → 7[21] → [22]C → EA → BF → [16]E → [16]0 → 19 (base=23)

Base-33 is also short:

1 → 2 → 4 → 8 → [16] → [32] → 1[31] → [32]0 → 1[31] (base=33)

And so is base-35:

1 → 2 → 4 → 8 → [16] → [32] → 1[29] → [29][31] → [33][19] → [21]F → [16][22] → [23][19] → [20][30] → [32]0 → 1[29] (base=35)

So what about base-34?

1 → 2 → 4 → 8 → [16] → [32] → 1[30] → [30][32] → 10[24] → [24]0[26] → [26]26 → 63[26] → [26]47 → 75[29] → [29]6E → E8A → A9C → CA7 → 7B7 → 7B[32] → [32]C[23] → [23]E[31] → [31][16][23] → [23][18][33] → [33][20][29] → [29][23]D → D[25][26] → [26][27]9 → 9[29][20] → [20][30][33] → [33][33]1 → 21[32] → [32]23 → 341 → 14B → B4[17] → [17]59 → 96E → E74 → 485 → 58[21] → [21]95 → 5A[22] → [22]B8 → 8C[29] → [29]D[23] → [23]F[26] → [26][17][19] → [19][19][20] → [20][21]9 → 9[23]2 → 2[24]9 → 9[25]3 → 3[26]C → C[27]A → A[28][27] → [27][30]7 → 7[32][23] → [24]01 → 11F → F1[18] → [18]2F → F3[19] → [19]4[18] → [18]5[26] → [26]6[33] → [33]8[23] → [23]A[29] → [29]C[17] → [17]E[19] → [19]F[33] → [33][17][18] → [18][19][33] → [33][21][20] → [20][24]5 → 5[26]1 → 1[27]3 → 3[27][32] → [32][28][31] → [31][31][21] → [22]0C → C1[22] → [22]2D → D3[25] → [25]4[20] → [20]66 → 67[18] → [18]83 → 39D → D9[28] → [28]A[29] → [29]C[27] → [27]E[29] → [29][16][29] → [29][19]1 → 1[21]A → A[21][33] → [33][23]6 → 6[25][27] → [27][26][30] → [30][29]8 → 8[31][29] → [29][33]8 → 91[31] → [31]2[16] → [16]4C → C5E → E69 → 979 → 980 → 8[26] → [27]8 → 9[28] → [29]C → E2 → 2[30] → [31]0 → 1[28] → [28][30] → [32][18] → [20]E → F[20] → [21][16] → [17][24] → [25][24] → [26]6 → 7[24] → [25]4 → 5[20] → [20][30] → [32]2 → 3[32] → [33]4 → 62 → 2E → E[18] → [19]C → D[16] → [17]8 → 98 → 8[26] (1 leads to a 30-loop from 8[26] / 298 in base-34 at step 111; total steps = 141)

An alternative rule is to add the digit-sum first and then reverse the result. Now 8 becomes 8 + 8 = 16 and 16 becomes 61. Then 61 becomes 61 + 6 + 1 = 68 and 68 becomes 86. Then 86 becomes 86 + 8 + 6 = 100 and 100 becomes 001 = 1:

• 1 → 2 → 4 → 8 → 61 → 86 → 1
• 2 → 4 → 8 → 61 → 86 → 1 → 2
• 3 → 6 → 21 → 42 → 84 → 69 → 48 → 6
• 4 → 8 → 61 → 86 → 1 → 2 → 4
• 5 → 1 → 2 → 4 → 8 → 62 → 7 → 48 → 6 → 27 → 63 → 27
• 6 → 21 → 42 → 84 → 69 → 48 → 6
• 7 → 41 → 64 → 47 → 85 → 89 → 601 → 806 → 28 → 83 → 49 → 26 → 43 → 5 → 6 → 27 → 63 → 27
• 8 → 61 → 86 → 1 → 2 → 4 → 8
• 9 → 81 → 9
• 10 → 11 → 31 → 53 → 16 → 32 → 73 → 38 → 94 → 701 → 907 → 329 → 343 → 353 → 463 → 674 → 196 → 212 → 712 → 227 → 832 → 548 → 565 → 185 → 991 → 101 → 301 → 503 → 115 → 221 → 622 → 236 → 742 → 557 → 475 → 194→ 802 → 218 → 922 → 539 → 655 → 176 → 91 → 102 → 501 → 705 → 717 → 237 → 942 → 759 → 87 → 208 → 812 → 328 → 143 → 151 → 851 → 568 → 785 → 508 → 125 → 331 → 833 → 748 → 767 → 787 → 908 → 529 → 545 → 955 → 479 → 994 → 6102 → 1116 → 5211 → 225 → 432 → 144 → 351 → 63 → 27 → 63

Block and Goal

123456789. How many ways are there to insert + and – between the numbers and create a formula for 100? With pen and ink it takes a long time to answer. With programming, the answer will flash up in an instant:

01. 1 + 2 + 3 - 4 + 5 + 6 + 78 + 9 = 100
02. 1 + 2 + 34 - 5 + 67 - 8 + 9 = 100
03. 1 + 23 - 4 + 5 + 6 + 78 - 9 = 100
04. 1 + 23 - 4 + 56 + 7 + 8 + 9 = 100
05. 12 - 3 - 4 + 5 - 6 + 7 + 89 = 100
06. 12 + 3 + 4 + 5 - 6 - 7 + 89 = 100
07. 12 + 3 - 4 + 5 + 67 + 8 + 9 = 100
08. 123 - 4 - 5 - 6 - 7 + 8 - 9 = 100
09. 123 + 4 - 5 + 67 - 89 = 100
10. 123 + 45 - 67 + 8 - 9 = 100
11. 123 - 45 - 67 + 89 = 100

And the beauty of programming is that you can easily generalize the problem to other bases. In base b, how many ways are there to insert + and – in the block [12345…b-1] to create a formula for b^2? When b = 10, the answer is 11. When b = 11, it’s 42. Here are two of those formulae in base-11:

123 - 45 + 6 + 7 - 8 + 9 + A = 100[b=11]
146 - 49 + 6 + 7 - 8 + 9 + 10 = 121

123 + 45 + 6 + 7 - 89 + A = 100[b=11]
146 + 49 + 6 + 7 - 97 + 10 = 121

When b = 12, it’s 51. Here are two of the formulae:

123 + 4 + 5 + 67 - 8 - 9A + B = 100[b=12]
171 + 4 + 5 + 79 - 8 - 118 + 11 = 144

123 + 4 + 56 + 7 - 89 - A + B = 100[b=12]
171 + 4 + 66 + 7 - 105 - 10 + 11 = 144

So that’s 11 formulae in base-10, 42 in base-11 and 51 in base-12. So what about base-13? The answer may be surprising: in base-13, there are no +/- formulae for 13^2 = 169 using the numbers 1 to 12. Nor are there any formulae in base-9 for 9^2 = 81 using the numbers 1 to 8. If you reverse the block, 987654321, the same thing happens. Base-10 has 15 formulae, base-11 has 54 and base-12 has 42. Here are some examples:

9 - 8 + 7 + 65 - 4 + 32 - 1 = 100
98 - 76 + 54 + 3 + 21 = 100

A9 + 87 - 65 + 4 - 3 - 21 = 100[b=11]
119 + 95 - 71 + 4 - 3 - 23 = 121

BA - 98 + 76 - 5 - 4 + 32 - 1 = 100[b=12]
142 - 116 + 90 - 5 - 4 + 38 - 1 = 144

But base-9 and base-13 again have no formulae. What’s going on? Is it a coincidence that 9 and 13 are each one more than a multiple of 4? No. Base-17 also has no formulae for b^2 = 13^2 = 169. Here is the list of formulae for bases-7 thru 17:

1, 2, 0, 11, 42, 51, 0, 292, 1344, 1571, 0 (block = 12345...)
3, 2, 0, 15, 54, 42, 0, 317, 1430, 1499, 0 (block = ...54321)

To understand what’s going on, consider any sequence of consecutive integers starting at 1. The number of odd integers in the sequence must always be greater than or equal to the number of even integers:

1, 2 (1 odd : 1 even)
1, 2, 3 (2 odds : 1 even)
1, 2, 3, 4 (2 : 2)
1, 2, 3, 4, 5 (3 : 2)
1, 2, 3, 4, 5, 6 (3 : 3)
1, 2, 3, 4, 5, 6, 7 (4 : 3)
1, 2, 3, 4, 5, 6, 7, 8 (4 : 4)

The odd numbers in a sequence determine the parity of the sum, that is, whether it is odd or even. For example:

1 + 2 = 3 (1 odd number)
1 + 2 + 3 = 6 (2 odd numbers)
1 + 2 + 3 + 4 = 10 (2 odd numbers)
1 + 2 + 3 + 4 + 5 = 15 (3 odd numbers)
1 + 2 + 3 + 4 + 5 + 6 = 21 (3 odd numbers)
1 + 2 + 3 + 4 + 5 + 6 + 7 = 28 (4 odd numbers)

If there is an even number of odd numbers, the sum will be even; if there is an odd number, the sum will be odd. Consider sequences that end in a multiple of 4:

1, 2, 3, 4 → 2 odds : 2 evens
1, 2, 3, 4, 5, 6, 7, 8 → 4 : 4
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 → 6 : 6

Such sequences always contain an even number of odd numbers. Now, consider these formulae in base-10:

1. 12 + 3 + 4 + 56 + 7 + 8 + 9 = 99
2. 123 - 45 - 67 + 89 = 100
3. 123 + 4 + 56 + 7 - 89 = 101

They can be re-written like this:

1. 1×10^1 + 2×10^0 + 3×10^0 + 4×10^0 + 5×10^1 + 6×10^0 + 7×10^0 + 8×10^0 + 9×10^0 = 99

2. 1×10^2 + 2×10^1 + 3×10^0 – 4×10^1 – 5×10^0 – 6×10^1 – 7×10^0 + 8×10^1 + 9×10^0 = 100

3. 1×10^2 + 2×10^1 + 3×10^0 + 4×10^0 + 5×10^1 + 6×10^1 + 7×10^0 – 8×10^1 – 9×10^0 = 101

In general, the base-10 formulae will take this form:

1×10^a +/- 2×10^b +/- 3×10^c +/– 4×10^d +/– 5×10^e +/– 6×10^f +/– 7×10^g +/– 8×10^h +/– 9×10^i = 100

It’s important to note that the exponent of 10, or the power to which it is raised, determines whether an odd number remains odd or becomes even. For example, 3×10^0 = 3×1 = 3, whereas 3×10^1 = 3×10 = 30 and 3×10^2 = 3×100 = 300. Therefore the number of odd numbers in a base-10 formula can vary and so can the parity of the sum. Now consider base-9. When you’re trying to find a block-formula for 9^2 = 81, the formula will have to take this form:

1×9^a +/- 2×9^b +/- 3×9^c +/- 4×9^d +/- 5×9^e +/- 6×9^f +/- 7×9^g +/- 8×9^h = 81

But no such formula exists for 81 (with standard exponents). It’s now possible to see why this is so. Unlike base-10, the odd numbers in the formula will remain odd what the power of 9. For example, 3×9^0 = 3×1 = 3, 3×9^1 = 3×9 = 27 and 3×9^2 = 3×81 = 243. Therefore base-9 formulae will always contain four odd numbers and will always produce an even number. Odd numbers in base-2 always end in 1, even numbers always end in 0. Therefore, to determine the parity of a sum of integers, convert the integers to base-2, discard all but the final digit of each integer, then sum the 1s. In a base-9 formula, these are the four possible results:

1 + 1 + 1 + 1 = 4
1 + 1 + 1 - 1 = 2
1 + 1 - 1 - 1 = 0
1 - 1 - 1 - 1 = -2

The sum represents the parity of the answer, which is always even. Similar reasoning applies to base-13, base-17 and all other base-[b=4n+1].

Persist List

Multiplicative persistence is a complex term but a simple concept. Take a number, multiply its digits, repeat. Sooner or later the result is a single digit:

25 → 2 x 5 = 10 → 1 x 0 = 0 (mp=2)
39 → 3 x 9 = 27 → 2 x 7 = 14 → 1 x 4 = 4 (mp=3)

So 25 has a multiplicative persistence of 2 and 39 a multiplicative persistence of 3. Each is the smallest number with that m.p. in base-10. Further records are set by these numbers:

77 → 49 → 36 → 18 → 8 (mp=4)
679 → 378 → 168 → 48 → 32 → 6 (mp=5)
6788 → 2688 → 768 → 336 → 54 → 20 → 0 (mp=6)
68889 → 27648 → 2688 → 768 → 336 → 54 → 20 → 0 (mp=7)
2677889 → 338688 → 27648 → 2688 → 768 → 336 → 54 → 20 → 0 (mp=8)
26888999 → 4478976 → 338688 → 27648 → 2688 → 768 → 336 → 54 → 20 → 0 (mp=9)
3778888999 → 438939648 → 4478976 → 338688 → 27648 → 2688 → 768 → 336 → 54 → 20 → 0 (mp=10)

Now here’s base-9:

25[b=9] → 11 → 1 (mp=2)
38[b=9] → 26 → 13 → 3 (mp=3)
57[b=9] → 38 → 26 → 13 → 3 (mp=4)
477[b=9] → 237 → 46 → 26 → 13 → 3 (mp=5)
45788[b=9] → 13255 → 176 → 46 → 26 → 13 → 3 (mp=6)
2577777[b=9] → 275484 → 13255 → 176 → 46 → 26 → 13 → 3 (mp=7)

And base-11:

26[b=11] → 11 → 1 (mp=2)
3A[b=11] → 28 → 15 → 5 (mp=3)
69[b=11] → 4A → 37 → 1A → A (=10b=10) (mp=4)
269[b=11] → 99 → 74 → 26 → 11 → 1 (mp=5)
3579[b=11] → 78A → 46A → 1A9 → 82 → 15 → 5 (mp=6)
26778[b=11] → 3597 → 78A → 46A → 1A9 → 82 → 15 → 5 (mp=7)
47788A[b=11] → 86277 → 3597 → 78A → 46A → 1A9 → 82 → 15 → 5 (mp=8)
67899AAA[b=11] → 143A9869 → 299596 → 2A954 → 2783 → 286 → 88 → 59 → 41 → 4 (mp=9)
77777889999[b=11] → 2AA174996A → 143A9869 → 299596 → 2A954 → 2783 → 286 → 88 → 59 → 41 → 4 (mp=10)

I was also interested in the narcissism of multiplicative persistence. That is, are any numbers equal to the sum of the numbers created while calculating their multiplicative persistence? Yes:

86 = (8 x 6 = 48) + (4 x 8 = 32) + (3 x 2 = 6)

I haven’t found any more in base-10 (apart from the trivial 0 to 9) and can’t prove that this is the only one. Base-9 offers this:

78[b=9] = 62 + 13 + 3

I can’t find any at all in base-11, but here are base-12 and base-27:

57[b=12] = 2B + 1A + A
A8[b=12] = 68 + 40 + 0

4[23][b=27] = 3B + 16 + 6
7[24][b=27] = 66 + 19 + 9
A[18][b=27] = 6[18] + 40 + 0
[26][24][b=27] = [23]3 + 2F + 13 + 3
[26][23][26][b=27] = [21]8[23] + 583 + 4C + 1[21] + [21]

But the richest base I’ve found so far is base-108, with fourteen narcissistic multiplicative-persistence sums:

4[92][b=108] = 3[44] + 1[24] + [24]
5[63][b=108] = 2[99] + 1[90] + [90]
7[96][b=108] = 6[24] + 1[36] + [36]
A[72][b=108] = 6[72] + 40 + 0
[19][81][b=108] = E[27] + 3[54] + 1[54] + [54]
[26][96][b=108] = [23]C + 2[60] + 1C + C
[35][81][b=108] = [26][27] + 6[54] + 30 + 0
[37][55][b=108] = [18][91] + F[18] + 2[54] + 10 + 0
[73][60][b=108] = [40][60] + [22][24] + 4[96] + 3[60] + 1[72] + [72]
[107][66][b=108] = [65][42] + [25][30] + 6[102] + 5[72] + 3[36] + 10 + 0
[71][84][b=108] = [55][24] + C[24] + 2[72] + 1[36] + [36]
[107][99][b=108] = [98]9 + 8[18] + 1[36] + [36]
5[92][96][b=108] = 3[84][96] + 280 + 0
8[107][100][b=108] = 7[36][64] + 1[41][36] + D[72] + 8[72] + 5[36] + 1[72] + [72]


Update (10/ii/14): The best now is base-180 with eighteen multiplicative-persistence sums.

5[105][b=180] = 2[165] + 1[150] + [150]
7[118][b=180] = 4[106] + 2[64] + [128]
7[160][b=180] = 6[40] + 1[60] + [60]
8[108][b=180] = 4[144] + 3[36] + [108]
A[120][b=180] = 6[120] + 40 + 0 (s=5)
[19][135][b=180] = E[45] + 3[90] + 1[90] + [90]
[21][108][b=180] = C[108] + 7[36] + 1[72] + [72]
[26][160][b=180] = [23][20] + 2[100] + 1[20] + [20]
[31][98][b=180] = [16][158] + E8 + [112]
[35][135][b=180] = [26][45] + 6[90] + 30 + 0 (s=10)
[44][96][b=180] = [23][84] + A[132] + 7[60] + 2[60] + [120]
[71][140][b=180] = [55][40] + C[40] + 2[120] + 1[60] + [60]
[73][100][b=180] = [40][100] + [22][40] + 4[160] + 3[100] + 1[120] + [120]
[107][110][b=180] = [65][70] + [25][50] + 6[170] + 5[120] + 3[60] + 10 + 0
[107][165][b=180] = [98]F + 8[30] + 1[60] + [60] (s=15)
[172][132][b=180] = [126][24] + [16][144] + C[144] + 9[108] + 5[72] + 20 + 0
5[173][145][b=180] = 3[156][145] + 2[17]0 + 0
E[170][120][b=180] = 8[146][120] + 4[58][120] + [154][120] + [102][120] + [68]0 + 0

Six Six Nix

4 x 3 = 13. A mistake? Not in base-9, where 13 = 1×9^1 + 3 = 12 in base-10. This means that 13 is a sum-product number in base-9: first add its digits, then multiply them, then multiply the digit-sum by the digit-product: (1+3) x (1×3) = 13[9]. There are four more sum-product numbers in this base:

2086[9] = 17 x 116 = (2 + 8 + 6) x (2 x 8 x 6) = 1536[10] = 16 x 96
281876[9] = 35 x 7333 = (2 + 8 + 1 + 8 + 7 + 6) x (2 x 8 x 1 x 8 x 7 x 6) = 172032[10] = 32 x 5376
724856[9] = 35 x 20383 = (7 + 2 + 4 + 8 + 5 + 6) x (7 x 2 x 4 x 8 x 5 x 6) = 430080[10] = 32 x 13440
7487248[9] = 44 x 162582 = (7 + 4 + 8 + 7 + 2 + 4 + 8) x (7 x 4 x 8 x 7 x 2 x 4 x 8) = 4014080[10] = 40 x 100352

And that’s the lot, apart from the trivial 0 = (0) x (0) and 1 = (1) x (1), which are true in all bases.

What about base-10?

135 = 9 x 15 = (1 + 3 + 5) x (1 x 3 x 5)
144 = 9 x 16 = (1 + 4 + 4) x (1 x 4 x 4)
1088 = 17 x 64 = (1 + 8 + 8) x (1 x 8 x 8)

1088 is missing from the list at Wikipedia and the Encyclopedia of Integer Sequences, but I like the look of it, so I’m including it here. Base-11 has five sum-product numbers:

419[11] = 13 x 33 = (4 + 1 + 9) x (4 x 1 x 9) = 504[10] = 14 x 36
253[11] = [10] x 28 = (2 + 5 + 3) x (2 x 5 x 3) = 300[10] = 10 x 30
2189[11] = 19 x 121 = (2 + 1 + 8 + 9) x (2 x 1 x 8 x 9) = 2880[10] = 20 x 144
7634[11] = 19 x 419 = (7 + 6 + 3 + 4) x (7 x 6 x 3 x 4) = 10080[10] = 20 x 504
82974[11] = 28 x 3036 = (8 + 2 + 9 + 7 + 4) x (8 x 2 x 9 x 7 x 4) = 120960[10] = 30 x 4032

But the record for bases below 50 is set by 7:

22[7] = 4 x 4 = (2 + 2) x (2 x 2) = 16[10] = 4 x 4
505[7] = 13 x 34 = (5 + 5) x (5 x 5) = 250[10] = 10 x 25
242[7] = 11 x 22 = (2 + 4 + 2) x (2 x 4 x 2) = 128[10] = 8 x 16
1254[7] = 15 x 55 = (1 + 2 + 5 + 4) x (1 x 2 x 5 x 4) = 480[10] = 12 x 40
2343[7] = 15 x 132 = (2 + 3 + 4 + 3) x (2 x 3 x 4 x 3) = 864[10] = 12 x 72
116655[7] = 33 x 2424 = (1 + 1 + 6 + 6 + 5 + 5) x (1 x 1 x 6 x 6 x 5 x 5) = 21600[10] = 24 x 900
346236[7] = 33 x 10362 = (3 + 4 + 6 + 2 + 3 + 6) x (3 x 4 x 6 x 2 x 3 x 6) = 62208[10] = 24 x 2592
424644[7] = 33 x 11646 = (4 + 2 + 4 + 6 + 4 + 4) x (4 x 2 x 4 x 6 x 4 x 4) = 73728[10] = 24 x 3072

And base-6? Six Nix. There are no sum-product numbers unique to that base (to the best of my far-from-infallible knowledge). Here is the full list for base-3 to base-50 (not counting 0 and 1 as sum-product numbers):

5 in base-11 4 in base-21 3 in base-31 2 in base-41
4 in base-12 5 in base-22 1 in base-32 3 in base-42
0 in base-3 3 in base-13 4 in base-23 3 in base-33 4 in base-43
2 in base-4 3 in base-14 2 in base-24 4 in base-34 5 in base-44
1 in base-5 2 in base-15 3 in base-25 2 in base-35 6 in base-45
0 in base-6 2 in base-16 6 in base-26 2 in base-36 7 in base-46
8 in base-7 6 in base-17 0 in base-27 3 in base-37 3 in base-47
1 in base-8 5 in base-18 1 in base-28 3 in base-38 7 in base-48
5 in base-9 7 in base-19 0 in base-29 1 in base-39 5 in base-49
3 in base-10 3 in base-20 2 in base-30 2 in base-40 3 in base-50

Narcissarithmetic

Why is 438,579,088 a beautiful number? Simple: it may seem entirely arbitrary, but it’s actually self-empowered:

438,579,088 = 4^4 + 3^3 + 8^8 + 5^5 + 7^7 + 9^9 + 0^0 + 8^8 + 8^8 = 256 + 27 + 16777216 + 3125 + 823543 + 387420489 + 0 + 16777216 + 16777216 (usually 0^0 = 1, but the rule is slightly varied here)

438,579,088 is so beautiful, in fact, that it’s in love with itself as a narcissistic number, or number that can be generated by manipulation of its own digits. 89 = 8^1 + 9^2 = 8 + 81 and 135 = 1^1 + 3^2 + 5^3 = 1 + 9 + 125 are different kinds of narcissistic number. 3435 is self-empowered again:

3435 = 3^3 + 4^4 + 3^3 + 5^5 = 27 + 256 + 27 + 3125

But that’s your lot: there are no more numbers in base-10 that are equal to the sum of their self-empowered digits (apart from the trivial 0 and 1). To prove this, start by considering that there is a limit to the size of a self-empowered number. 9^9 is 387,420,489, which is nine digits long. The function autopower(999,999,999) = 387,420,489 x 9 = 3,486,784,401, which is ten digits long. But autopower(999,999,999,999) = 387,420,489 x 12 = 4,649,045,868, also ten digits long.

The Metamorphosis of Narcissus by Salvador Dalí

Salvador Dalí, La Metamorfosis de Narciso (1937)

So you don’t need to check numbers above a certain size. There still seem a lot of numbers to check: 438,579,088 is a long way above 3435. However, the search is easy to shorten if you consider that checking 3-3-4-5 is equivalent to checking 3-4-3-5, just as checking 034,578,889 is equivalent to checking 438,579,088. If you self-empower a number and the result has the same digits as the original number, you’ve found what you’re looking for. The order of digits in the original number doesn’t matter, because the result has automatically sorted them for you. The function autopower(3345) produces 3435, therefore 3435 must be self-empowered.

So the rule is simple: Check only the numbers in which any digit is greater than or equal to all digits to its left. In other words, you check 12 and skip 21, check 34 and skip 43, check 567 and skip 576, 657, 675, 756 and 765. That reduces the search-time considerably: discarding numbers is computationally simpler than self-empowering them. It’s also computationally simple to vary the base in which you’re searching. Base-10 produces only two self-empowered numbers, but its neighbours base-9 and base-11 are much more fertile:

30 = 3^3 + 0^0 = 30 + 0 (b=9)
27 = 27 + 0 (b=10)

31 = 3^3 + 1^1 = 30 + 1 (b=9)
28 = 27 + 1 (b=10)

156262 = 1^1 + 5^5 + 6^6 + 2^2 + 6^6 + 2^2 = 1 + 4252 + 71000 + 4 + 71000 + 4 (b=9)
96446 = 1 + 3125 + 46656 + 4 + 46656 + 4 (b=10)

1647063 = 1^1 + 6^6 + 4^4 + 7^7 + 0^0 + 6^6 + 3^3 = 1 + 71000 + 314 + 1484617 + 0 + 71000 + 30 (b=9)
917139 = 1 + 46656 + 256 + 823543 + 0 + 46656 + 27 (b=10)

1656547 = 1^1 + 6^6 + 5^5 + 6^6 + 5^5 + 4^4 + 7^7 = 1 + 71000 + 4252 + 71000 + 4252 + 314 + 1484617 (b=9)
923362 = 1 + 46656 + 3125 + 46656 + 3125 + 256 + 823543 (b=10)

34664084 = 3^3 + 4^4 + 6^6 + 6^6 + 4^4 + 0^0 + 8^8 + 4^4 = 30 + 314 + 71000 + 71000 + 314 + 0 + 34511011 + 314 (b=9)
16871323 = 27 + 256 + 46656 + 46656 + 256 + 0 + 16777216 + 256 (b=10)

66500 = 6^6 + 6^6 + 5^5 + 0^0 + 0^0 = 32065 + 32065 + 2391 + 0 + 0 (b=11)
96437 = 46656 + 46656 + 3125 + 0 + 0 (b=10)

66501 = 6^6 + 6^6 + 5^5 + 0^0 + 1^1 = 32065 + 32065 + 2391 + 0 + 1 (b=11)
96438 = 46656 + 46656 + 3125 + 0 + 1 (b=10)

517503 = 5^5 + 1^1 + 7^7 + 5^5 + 0^0 + 3^3 = 2391 + 1 + 512816 + 2391 + 0 + 25 (b=11)
829821 = 3125 + 1 + 823543 + 3125 + 0 + 27 (b=10)

18453278 = 1^1 + 8^8 + 4^4 + 5^5 + 3^3 + 2^2 + 7^7 + 8^8 = 1 + 9519A75 + 213 + 2391 + 25 + 4 + 512816 + 9519A75 (b=11)
34381388 = 1 + 16777216 + 256 + 3125 + 27 + 4 + 823543 + 16777216 (b=10)

18453487 = 1^1 + 8^8 + 4^4 + 5^5 + 3^3 + 4^4 + 8^8 + 7^7 = 1 + 9519A75 + 213 + 2391 + 25 + 213 + 9519A75 + 512816 (b=11)
34381640 = 1 + 16777216 + 256 + 3125 + 27 + 256 + 16777216 + 823543 (b=10)

It’s easy to extend the concept of self-empowered narcisso-numbers. The prime 71 = 131 in base-7 and the prime 83 = 146 in base-7. If 131[b=7] is empowered to the digits of 146[b=7], you get 146[b=7]; and if 146[b=7] is empowered to the digits of 131[b=7], you get 131[b=7], like this:

71 = 131[b=7] → 1^1 + 3^4 + 1^6 = 1 + 81 + 1 = 83 = 146[b=7]

83 = 146[b=7] → 1^1 + 4^3 + 6^1 = 1 + 64 + 6 = 71 = 131[b=7]

But it’s not easy to find more examples. Are there other-empowering pairs like that in base-10? I don’t know.

In Perms Of

13 is a prime number, divisible only by itself and 1. Perm 13 and you get 31, which is also a prime number. The same is true of 17, 37 and 79. There are only two possible permutations – 2 x 1 – of a two-digit number, so base-10 is terminally permal for two-digit primes:

13, 31
17, 71
37, 73
79, 97

What about three-digit primes? Now there are six possible permutations: 3 x 2 x 1. But base-10 is not terminally permal for three-digit primes. This is the best it does:

149, 419, 491, 941
179, 197, 719, 971
379, 397, 739, 937

Fortunately, we aren’t restricted to base-10. Take a step up and you’ll find that base-11 is terminally permal for three-digit primes (139 in base-11 = 1 x 11^2 + 3 x 11 + 9 = 163 in base-10):

139, 193, 319, 391, 913, 931 (6 primes) (base=11)

163, 223, 383, 463, 1103, 1123 (base=10)

Four-digit primes have twenty-four possible permutations – 4 x 3 x 2 x 1 – and base-10 again falls short:

1237, 1327, 1723, 2137, 2371, 
2713, 2731, 3217, 3271, 7213,
7321 (11 primes)

1279, 1297, 2179, 2719, 2791,
2917, 2971, 7129, 7219, 9127,
9721

For four-digit primes, the most permal base I’ve discovered so far is base-13 (where B represents [11]):

134B, 13B4, 14B3, 1B34, 1B43,
314B, 31B4, 34B1, 3B14, 413B,
41B3, 431B, 43B1, 4B13, 4B31,
B134, B143, B314, B413 (19 primes) (base=13)

2767, 2851, 3019, 4099, 4111,
6823, 6907, 7411, 8467, 9007,
9103, 9319, 9439, 10663, 10687,
24379, 24391, 24691, 24859 (base=10)

Is there a base in which all permutations of some four-digit number are prime? I think so, but I haven’t found it yet. Is there always some base, b, in which all permutations of some d-digit number are prime? Is there an infinity of bases in which all permutations of some d-digit number are prime? Easy to ask, difficult to answer. For me, anyway.

Factory Records

The factors of n are those numbers that divide n without remainder. So the factors of 6 are 1, 2, 3 and 6. If the function s(n) is defined as “the sum of the factors of n, excluding n, then s(6) = 1 + 2 + 3 = 6. This makes 6 a perfect number: its factors re-create it. 28 is another perfect number. The factors of 28 are 1, 2, 4, 7, 14 and 28, so s(28) = 1 + 2 + 4 + 7 + 14 = 28. Other perfect numbers are 496 and 8128. And they’re perfect in any base.

Amicable numbers are amicable in any base too. The factors of an amicable number sum to a second number whose factors sum to the first number. So s(220) = 284, s(284) = 220. That pair may have been known to Pythagoras (c.570-c.495 BC), but s(1184) = 1210, s(1210) = 1184 was discovered by an Italian schoolboy called Nicolò Paganini in 1866. There are also sociable chains, in which s(n), s(s(n)), s(s(s(n))) create a chain of numbers that leads back to n, like this:

12496 → 14288 → 15472 → 14536 → 14264 → 12496 (c=5)

Or this:

14316 → 19116 → 31704 → 47616 → 83328 → 177792 → 295488 → 629072 → 589786 → 294896 → 358336 → 418904 → 366556 → 274924 → 275444 → 243760 → 376736 → 381028 → 285778 → 152990 → 122410 → 97946 → 48976 → 45946 → 22976 → 22744 → 19916 → 17716 → 14316 (c=28)

Those sociable chains were discovered (and christened) in 1918 by the Belgian mathematician Paul Poulet (1887-1946). Other factor-sum patterns are dependant on the base they’re expressed in. For example, s(333) = 161. So both n and s(n) are palindromes in base-10. Here are more examples — the numbers in brackets are the prime factors of n and s(n):

333 (3^2, 37) → 161 (7, 23)
646 (2, 17, 19) → 434 (2, 7, 31)
656 (2^4, 41) → 646 (2, 17, 19)
979 (11, 89) → 101 (prime)
1001 (7, 11, 13) → 343 (7^3)
3553 (11, 17, 19) → 767 (13, 59)
10801 (7, 1543) → 1551 (3, 11, 47)
11111 (41, 271) → 313 (prime)
18581 (17, 1093) → 1111 (11, 101)
31713 (3, 11, 31^2) → 15951 (3, 13, 409)
34943 (83, 421) → 505 (5, 101)
48484 (2^2, 17, 23, 31) → 48284 (2^2, 12071)
57375 (3^3, 5^3, 17) → 54945 (3^3, 5, 11, 37)
95259 (3, 113, 281) → 33333 (3, 41, 271)
99099 (3^2, 7, 11^2, 13) → 94549 (7, 13, 1039)
158851 (7, 11, 2063) → 39293 (prime)
262262 (2, 7, 11, 13, 131) → 269962 (2, 7, 11, 1753)
569965 (5, 11, 43, 241) → 196691 (11, 17881)
1173711 (3, 7, 11, 5081) → 777777 (3, 7^2, 11, 13, 37)

Note how s(656) = 646 and s(646) = 434. There’s an even longer sequence in base-495:

33 → 55 → 77 → 99 → [17][17] → [19][19] → [21][21] → [43][43] → [45][45] → [111][111] → [193][193] → [195][195] → [477][477] (b=495) (c=13)
1488 (2^4, 3, 31) → 2480 (2^4, 5, 31) → 3472 (2^4, 7, 31) → 4464 (2^4, 3^2, 31) → 8432 (2^4, 17, 31) → 9424 (2^4, 19, 31) → 10416 (2^4, 3, 7, 31) → 21328 (2^4, 31, 43) → 22320 (2^4, 3^2, 5, 31) → 55056 (2^4, 3, 31, 37) → 95728 (2^4, 31, 193) → 96720 (2^4, 3, 5, 13, 31) → 236592 (2^4, 3^2, 31, 53)

I also tried looking for n whose s(n) mirrors n. But they’re hard to find in base-10. The first example is this:

498906 (2, 3^3, 9239) → 609894 (2, 3^2, 31, 1093)

498906 mirrors 609894, because the digits of each run in reverse to the digits of the other. Base-9 does better for mirror-sums, clocking up four in the same range of integers:

42 → 24 (base=9)
38 (2, 19) → 22 (2, 11)
402 → 204 (base=9)
326 (2, 163) → 166 (2, 83)
4002 → 2004 (base=9)
2918 (2, 1459) → 1462 (2, 17, 43)
5544 → 4455 (base=9)
4090 (2, 5, 409) → 3290 (2, 5, 7, 47)

Base-11 does better still, clocking up eight in the same range:

42 → 24 (base=11)
46 (2, 23) → 26 (2, 13)
2927 → 7292 (base=11)
3780 (2^2, 3^3, 5, 7) → 9660 (2^2, 3, 5, 7, 23)
4002 → 2004 (base=11)
5326 (2, 2663) → 2666 (2, 31, 43)
13772 → 27731 (base=11)
19560 (2^3, 3, 5, 163) → 39480 (2^3, 3, 5, 7, 47)
4[10]7[10]9 → 9[10]7[10]4 (base=11)
72840 (2^3, 3, 5, 607) → 146040 (2^3, 3, 5, 1217)
6929[10] → [10]9296 (base=11)
100176 (2^4, 3, 2087) → 158736 (2^4, 3, 3307)
171623 → 326171 (base=11)
265620 (2^2, 3, 5, 19, 233) → 520620 (2^2, 3, 5, 8677)
263702 → 207362 (base=11)
414790 (2, 5, 41479) → 331850 (2, 5^2, 6637)

Note that 42 mirrors its factor-sum in both base-9 and base-11. But s(42) = 24 in infinitely many bases, because when 42 = 2 x prime, s(42) = 1 + 2 + prime. So (prime-1) / 2 will give the base in which 24 = s(42). For example, 2 x 11 = 22 and 22 = 42 in base (11-1) / 2 or base-5. So s(42) = 1 + 2 + 11 = 14 = 2 x 5 + 4 = 24[b=5]. There are infinitely many primes, so infinitely many bases in which s(42) = 24.

Base-10 does better for mirror-sums when s(n) is re-defined to include n itself. So s(69) = 1 + 3 + 23 + 69 = 96. Here are the first examples of all-factor mirror-sums in base-10:

69 (3, 23) → 96 (2^5, 3)
276 (2^2, 3, 23) → 672 (2^5, 3, 7)
639 (3^2, 71) → 936 (2^3, 3^2, 13)
2556 (2^2, 3^2, 71) → 6552 (2^3, 3^2, 7, 13)

In the same range, base-9 now produces one mirror-sum, 13 → 31 = 12 (2^2, 3) → 28 (2^2, 7). Base-11 produces no mirror-sums in the same range. Base behaviour is eccentric, but that’s what makes it interesting.

Sumbertime Views

Like 666 (see Revelation 13:18), 153 (see John 21:11) appears in the Bible. And perhaps for the same reason: because it is the sum of successive integers. 153 = 1+2+3+…+17 = Σ(17), just as 666 = Σ(36). So both numbers are sum-numbers or sumbers. But 153 has other interesting properties, including one that can’t have been known in Biblical times, because numbers weren’t represented in the right way. It’s also the sum of the cubes of its digits: 153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27. So 153 is a cube-sumber or 3-sumber. The other 3-sumbers are 370, 371 and 407. There are 4-sumbers too, like 1,634 = 1^4 + 6^4 + 3^4 + 4^4, and 5-sumbers, like 194,979 = 1^5 + 9^5 + 4^5 + 9^5 + 7^5 + 9^5, and 6-sumbers, like 548,834 = 5^6 + 4^6 + 8^6 + 8^6 + 3^6 + 4^6.

But there are no 2-sumbers, or numbers that are the sum of the squares of their digits. It doesn’t take long to confirm this, because numbers above a certain size can’t be 2-sumbers. 9^2 + 9^2 = 162, but 9^2 + 9^2 + 9^2 = 243. So 2-sumbers can’t exist above 99 and if you search that high you’ll find that they don’t exist at all. At least not in this house, but they do exist in the houses next door. Base 10 yields nothing, so what about base 9?

4^2 + 5^2 = 45[9] = 41[10]
5^2 + 5^2 = 55[9] = 50

And base 11?

5^2 + 6^2 = 56[11] = 61[10]
6^2 + 6^2 = 66[11] = 72

This happens because odd bases always yield a pair of 2-sumbers whose second digit is one more than half the base and whose first digit is the same or one less. See above (and the appendix). Such a pair is found among the 14 sumbers of base 47, which is the best total till base 157 and its 22 sumbers. Here are the 2-sumbers for base 47:

2^2 + 10^2 = 104
3^2 + 12^2 = 153
5^2 + 15^2 = 250
9^2 + 19^2 = 442
12^2 + 21^2 = 585
14^2 + 22^2 = 680
23^2 + 24^2 = 1,105
24^2 + 24^2 = 1,152
33^2 + 22^2 = 1,573
35^2 + 21^2 = 1,666
38^2 + 19^2 = 1,805
42^2 + 15^2 = 1,989
44^2 + 12^2 = 2,080
45^2 + 10^2 = 2,125

As the progressive records for 2-sumber-totals are set, subsequent bases seem to either match or surpass them, except in three cases below base 450:

2 in base 5
4 in base 7
6 in base 13
10 in base 43
14 in base 47
22 in base 157
8 in base 182*
16 in base 268*
30 in base 307
18 in base 443*

Totals for sums of squares in bases 4 to 450

Totals for sums-of–squares in bases 4 to 450 (click for larger image)

Appendix: Odd Bases and 2-sumbers

Take an even number and half of that even number: say 12 and 6. 12 x 6 = 11 x 6 + 6. Further, 12 x 6 = 2 x 6 x 6 = 2 x 6^2 = 6^2 + 6^2. Accordingly, 66[11] = 6 x 11 + 6 = 12 x 6 = 6^2 + 6^2. So 66 in base 11 is a 2-sumber. Similar reasoning applies to every other odd base except base-3 [update: wrong!]. Now, take 12 x 5 = 2 x 6 x 5 = 2 x (5×5 + 5) = 5^2+5 + 5^5+5 = 5^5 + 5^5+2×5. Further, 5^5+2×5 = (5+1)(5+1) – 1 = 6^2 – 1. Accordingly, 56[11] = 11×5 + 6 = 12×5 + 1 = 5^2 + 6^2. Again, similar reasoning applies to every other odd base except base-3 [update: no — 1^2 + 2^2 = 12[3] = 5; 2^2 + 2^2 = 22[3] = 8]. This means that every odd base b, except base-3, will supply a pair of 2-sumbers with digits [d-1][d] and [d][d], where d = (b + 1) / 2.