Multi-Magic

A magic square is a square of numbers in which all rows, all columns and both diagonals add to the same number, or magic total. The simplest magic square using distinct numbers is this:

6 1 8
7 5 3
2 9 4

It’s easy to prove that the magic total of a 3×3 magic square must be three times the central number. Accordingly, if the central number is 37, the magic total must be 111. There are lots of ways to create a magic square with 37 at its heart, but this is my favourite:

43 | 01 | 67
61 | 37 | 13
07 | 73 | 31

The square is special because all the numbers are prime, or divisible by only themselves and 1 (though 1 itself is not usually defined as prime in modern mathematics). I like the 37-square even more now that I’ve discovered it can be found inside another all-prime magic square:

0619 = 0006[37] | 0097 = 00000010 | 1123 = [11][56]
1117 = [11][50] | 0613 = 0006[31] | 0109 = 0001[12]
0103 = 00000016 | 1129 = [11][62] | 0607 = 0006[25]

Magic total = 1839

The square is shown in both base-10 and base-97. If the digit-sums of the base-97 square are calculated, this is the result (e.g., the digit-sum of 6[37][b=97] = 6 + 37 = 43):

43 | 01 | 67
61 | 37 | 13
07 | 73 | 31

This makes me wonder whether the 613-square might nest in another all-prime square, and so on, perhaps ad infinitum [Update: yes, the 613-square is a nestling]. There are certainly many nested all-prime squares. Here is square-631 in base-187:

661 = 003[100] | 379 = 00000025 | 853 = 004[105]
823 = 004[075] | 631 = 003[070] | 439 = 002[065]
409 = 002[035] | 883 = 004[135] | 601 = 003[040]

Magic total = 1893

Digit-sums:

103 | 007 | 109
079 | 073 | 067
037 | 139 | 043

Magic total = 219

There are also all-prime magic squares that have two kinds of nestlings inside them: digit-sum magic squares and digit-product magic squares. The digit-product of a number is calculated by multiplying its digits (except 0): digit-product(37) = 3 x 7 = 21, digit-product(103) = 1 x 3 = 3, and so on. In base-331, this all-prime magic square yields both a digit-sum square and a digit-product square:

503 = 1[172] | 359 = 1[028] | 521 = 1[190]
479 = 1[148] | 461 = 1[130] | 443 = 1[112]
401 = 1[070] | 563 = 1[232] | 419 = 1[088]

Magic total = 1383

Digit-sums:

173 | 029 | 191
149 | 131 | 113
071 | 233 | 089

Magic total = 393

Digit-products:

172 | 028 | 190
148 | 130 | 112
070 | 232 | 088

Magic total = 390

Here are two more twin-bearing all-prime magic squares:

Square-719 in base-451:

761 = 1[310] | 557 = 1[106] | 839 = 1[388]
797 = 1[346] | 719 = 1[268] | 641 = 1[190]
599 = 1[148] | 881 = 1[430] | 677 = 1[226]

Magic total = 2157

Digit-sums:

311 | 107 | 389
347 | 269 | 191
149 | 431 | 227

Magic total = 807

Digit-products:

310 | 106 | 388
346 | 268 | 190
148 | 430 | 226

Magic total = 804

Square-853 in base-344:

883 = 2[195] | 709 = 2[021] | 967 = 2[279]
937 = 2[249] | 853 = 2[165] | 769 = 2[081]
739 = 2[051] | 997 = 2[309] | 823 = 2[135]

Magic total = 2559

Digit-sums:

197 | 023 | 281
251 | 167 | 083
053 | 311 | 137

Magic total = 501

Digit-products:

390 | 042 | 558
498 | 330 | 162
102 | 618 | 270

Magic total = 990

Proviously Post-Posted (please peruse):

More Multi-Magic

Roo’s Who

11 is a prime number, divisible by only itself and 1. If you add its digits, 1 + 1, you get 2. 11 + 2 = 13, another prime number. And 13 + (1 + 3) = 17, a third prime number. And there it ends, because 17 + (1 + 7) = 25 = 5 x 5. I call (11, 13, 17) kangaroo primes, because one jumps to another. In base 10, the record for numbers below 1,000,000 is this:

6 primes: 516493 + 28 = 516521 + 20 = 516541 + 22 = 516563 + 26 = 516589 + 34 = 516623.

In base 16, the record is this:

8 primes: 97397 = 17,C75[b=16] + 32 = 97429 = 17,C95[b=16] + 34 = 97463 = 17,CB7[b=16] + 38 = 97501 = 17,CDD[b=16] + 46 = 97547 = 17,D0B[b=16] + 32 = 97579 = 17,D2B[b=16] + 34 = 97613 = 17,D4D[b=16] + 38 = 97651 = 17,D73[b=16].

Another kind of kangaroo prime is found not by adding the sum of digits, but by adding their product, i.e., the result of multiplying the digits (except 0). 23 + (2 x 3) = 29. 29 + (2 x 9) = 47. But 47 + (4 x 7) = 75 = 3 x 5 x 5. So (23, 29, 47) are kangaroo primes too. In base 10, the record for numbers below 1,000,000 is this:

9 primes: 524219 + 720 = 524939 + 9720 = 534659 + 16200 = 550859 + 9000 = 559859 + 81000 = 640859 + 8640 = 649499 + 69984 = 719483 + 6048 = 725531.

But what about subtraction? For a reason I don’t understand, subtracting the digit-sum doesn’t seem to create any kangaroo-primes in base 10. But 11 in base 8 is 13 = 1 x 8^1 + 3 x 8^0 and 13[b=8] – (1 + 3) = 7. In base 2, this sequence appears:

1619 = 11,001,010,011[b=2] – 6 = 1613 = 11,001,001,101[b=2] – 6 = 1607 = 11,001,000,111[b=2] – 6 = 1601 = 11,001,000,001[b=2] – 4 = 1597.

However, subtracting the digit-product creates kangaroo-primes in base 10. For example, 23 – (2 x 3) = 17. The record below 1,000,000 is this (when 0 is found in the digits of a number, it is not included in the multiplication):

7 primes: 64037 – 504 = 63533 – 810 = 62723 – 504 = 62219 – 216 = 62003 – 36 = 61967 – 2268 = 59699.

Base 2 also provides examples of addition/subtraction pairs of kangaroo-primes, like this:

3 = 11[b=2] + 2 = 5 = 101[b=2] | 5 = 101[b=2] – 2 = 3

277 = 100,010,101[b=2] + 4 = 281 = 100,011,001[b=2] | 281 – 4 = 277

311 = 100,110,111[b=2] + 6 = 317 = 100,111,101[b=2] | 317 – 6 = 311

In base 10, addition/subtraction pairs are created by the digit-product, like this:

239 + 54 = 293 | 293 – 54 = 239
563 + 90 = 653 | 653 – 90 = 563
613 + 18 = 631 | 631 – 18 = 613
2791 + 126 = 2917 | 2917 – 126 = 2791
3259 + 270 = 3529 | 3529 – 270 = 3259
5233 + 90 = 5323 | 5323 – 90 = 5233
5297 + 630 = 5927 | 5927 – 630 = 5297
6113 + 18 = 6131 | 6131 – 18 = 6113
10613 + 18 = 10631 | 10631 – 18 = 10613
12791 + 126 = 12917 | 12917 – 126 = 12791

You could call these boxing primes, like boxing kangaroos. The two primes in the pair usually have the same digits in different arrangements, but there are also pairs like these:

24527 + 560 = 25087 | 25087 – 560 = 24527
25183 + 240 = 25423 | 25423 – 240 = 25183
50849 + 1440 = 52289 | 52289 – 1440 = 50849