Showing posts with label magic square. Show all posts
Showing posts with label magic square. Show all posts

Thursday, 23 January 2025

Maximum Determinants

I fell to thinking as to what is the maximum determinant that can arise when the digits from 1 to 9 are entered into a 3 x 3 matrix. I came across this site that stated that the maximum determinant is 412. An example of a matrix with this maximum determinant is:$$ \text{det }\begin{bmatrix} 1 & 4 & 8 \\ 7 & 2 & 6 \\ 5 & 9 & 3 \end{bmatrix} = 412$$It turns out that there is an OEIS sequence that lists the maximum determinants for matrices up to 7 x 7. It is OEIS A085000 :


  A085000  Maximal determinant of an \(n \times n\) matrix using the integers \(1\) to \(n^2\).

The sequence begins: 1, 10, 412, 40800, 6839492, 1865999570, 762150368499

The 2 x 2 configurations are easy enough as there are only a total 24 possible configurations. One example of a 2 x 2 matrix with the maximum determinant of 10 is:$$ \text{det }\begin{bmatrix} 3 & 1 \\ 2 &4 \end{bmatrix} =10$$Before moving on to the higher 4 x 4, 5 x 5 etc. determinants, let's look at some maximum determinants where more constraints are imposed on a 3 x 3 matrix than simply entering the digits 1 to 9. For example, let's say we want the determinant to be a palindrome or a square or a cube or a prime. Here are examples of matrices that successively satisfy these additional criteria (source):$$ \begin{align} \text{det } \begin{bmatrix} 1 & 4 & 7 \\ 9 & 2 & 6 \\ 5 & 8 & 3 \end{bmatrix} &= 404 \\ \\ \text{det } \begin{bmatrix} 1 & 4 & 8 \\ 7 & 3 & 6 \\ 5 & 9 & 2 \end{bmatrix} &= 400 =20^2 \\ \\ \text{det } \begin{bmatrix} 1 & 4 & 6 \\ 8 & 3 & 5 \\ 7 & 9 & 2 \end{bmatrix} &= 343 = 7^3 \\ \\ \text{det } \begin{bmatrix} 1 & 4 & 9 \\ 8 & 3 & 6 \\ 5 & 7 & 2 \end{bmatrix} &= 389 \end{align} $$For 3 x 3 magic squares, the determinant is always 360. Here is an example of such a magic square matrix:$$ \text{det } \begin{bmatrix} 8 & 1 & 6 \\ 3 & 5 & 7 \\ 4 & 9 & 2 \end{bmatrix} = 360 $$As can be seen from the OEIS information, the maximum determinant of a 4 x 4 matrix is 40800. Here is an example of such a matrix:$$ \text{det } \begin{bmatrix} 16 & 6 & 4 & 9 \\  8 & 13 & 11 & 1 \\ 3 & 12 & 5 & 14 \\ 7 & 2 & 15 & 10 \end{bmatrix}= 40800 $$For a 5 x 5 matrix, the maximum determinant is 6839492. Here is an example of such a matrix (source):$$ \text{det } \begin{bmatrix} 25 & 15 & 9 & 11 & 4 \\ 7 & 24 & 14 & 3 & 17 \\ 6 & 12 & 23 & 20 & 5 \\ 10 & 13 & 2 & 22 & 19 \\ 16 & 1 & 18 & 8 & 21 \end{bmatrix} =6839492 $$ I won't display examples of the 6 x 6 and 7 x 7 matrices where the maximums are 1865999570 and 762150368499 respectively but I'll instead quote from the OEIS comments:

a(6) found with FORTRAN program given at Pfoertner link. A corresponding matrix is ((36 24 21 17 5 8) ( 3 35 25 15 23 11) (13 7 34 16 10 31) (14 22 2 33 12 28) (20 4 19 29 32 6) (26 18 9 1 30 27) ). - Hugo Pfoertner, Sep 23 2003

a(7) is the determinant of the matrix ((46 42 15 2 27 24 18) (9 48 36 30 7 14 31) (39 11 44 34 13 29 5) (26 22 17 41 47 1 21) (20 8 40 6 33 23 45) (4 28 19 25 38 49 12) (32 16 3 37 10 35 43)). Although no proof for the optimality of a(7) is available, the results of an extensive computational search make the existence of a better solution extremely unlikely. A total of approximately 15 CPU years on SGI Origin 3000 and of 3.8 CPU years on SGI Altix 3000 computers was used for this result.

Saturday, 30 March 2024

A Truly Incredible Fact About The Number 37

It was this video from the YouTube channel Veritasium that made me aware of the considerable interest attached to the number 37.


I then found this post from a blogger, Chris Grossack, to be especially helpful in explaining the following:
37 is the median value for the second prime factor of an integer; thus the probability that the second prime factor of an integer chosen at random is smaller than 37 is approximately 50%.
He also uses SageMath for his calculations which was an added bonus. Here is the permalink to the calculation to determine the median using the first 100,000 numbers. The output is shown in Figure 1.


Figure 1

The actual proof is summarised in the information contained in Figure 2 which is more than I can comprehend, but I'll include it here:


Figure 2

The blogger uses the formulae shown in Figure 2 to once again show that 37 is the median value. Here is the permalink and the output is shown in Figure 3.


Figure 3

Of course this is not 37's only claim to fame. Wikipedia has an entry for the number 37 and some of the interesting facts contained in that article include a 3 x 3 magic square with 37 at its centre. See Figure 4.

Figure 4

Its magic constant is 37 x 3 = 111, where 3 and 37 are the first and third base-ten unique primes (the second such prime is 11). I wasn't familiar with the notion of a unique prime and so I'll include a definition from the Wikipedia article here:
A prime \(p\) (where \(p\) ≠ 2, 5 when working in base 10) is called unique if there is no other prime \(q\) such that the period length of the decimal expansion of its reciprocal, 1/\(p\), is equal to the period length of the reciprocal of \(q\), 1/\(q\). For example, 3 is the only prime with period 1, 11 is the only prime with period 2, 37 is the only prime with period 3, 101 is the only prime with period 4, so they are unique primes. The next larger unique prime is 9091 with period 10, though the next larger period is 9 (its prime being 333667). Unique primes were described by Samuel Yates in 1980.
I've written about 37 extensively as well in a post titled Star Numbers from the 7th of June 2019. There is a website dedicated to the number 37. It's mentioned by its creator in the YouTube video earlier but, as he himself admits, it hasn't been updated in very many years. However, it still contains a wealth of information.

For example, the site describes a method of determining if a number is divisible by 37. This is the method:
  • Divide the number up in groups of three digits, starting from the right.
    (The left-most group may not have three digits.)
  • Add the groups together.
  • Repeat steps 1 and 2 if the result is still longer than three digits, repeat steps 1 and 2.
  • Examine the final three-digit (or smaller) number
The original number is divisible by 37 if and only if this three-digit number is.

I often take note of car number plates here in Jakarta. These are typically of the form B-xxxx where xxxx is a four digit number. It's easy to determine if the four digit number is divisible by 3 because the first digit is simply added to the remaining three. Using leading zeros, the multiples of 37 are:

037, 074, 111, 148, 185, 222, 259, 296, 333, 370, 407, 444, 481, 518, 555, 592, 629, 666, 703, 740, 777, 814, 851, 888, 925, 962, 999

The repeated digit numbers (111 to 999) are a dead given away but the others are not two difficult to identify. Let's consider a number plate like B-1258. The 1258 --> 1 + 258 = 259 = 7 x 37. In this case, the 7 can be divided in to reveal the 37 rather than dealing with division by 37. There is no limit to what can be said about the number 37 but at least in this post and my earlier post of star numbers I've made a start.

Monday, 4 September 2023

Magic Constants Involving Prime Numbers

I recently turned 27180 days old and one of the properties of this number qualifies it for membership in OEIS A192087:


  A192087

Potential magic constants of a 10 X 10 magic square composed of consecutive primes.


The members of this sequence are (permalink):

2862, 3092, 3500, 4222, 4780, 5608, 7124, 10126, 10198, 11212, 11426, 12140, 12212, 12284, 12356, 12428, 12714, 12854, 12924, 15270, 16252, 16476, 18594, 18672, 18750, 18828, 19214, 20764, 21150, 23752, 24214, 24598, 24828, 27180, 27342, 27424, 27916, 28666, 29406, 29568

The OEIS comments are:
For a 10 X 10 magic square composed of 100 consecutive primes, the sum of these primes must be a multiple of 20. This sequence consists of even integers equal the sum of 100 consecutive primes divided by 10. It is not known whether each such set of consecutive primes can be arranged into a 10 X 10 magic square but it looks plausible. Actual magic squares were constructed for all listed magic constants less than or equal to 11212.

 Here are the confirmed magic squares:

S = 2862

23 179 409 373 263 137 461 457 523 37

193 353 443 199 317 109 337 397 131 383

71 73 389 251 593 167 439 449 233 197

571 293 101 229 29 557 271 31 379 401

127 419 283 241 269 239 547 89 181 467

491 433 223 113 41 577 43 311 563 67

281 97 163 587 191 313 149 509 421 151

307 499 227 431 103 83 59 479 211 463

277 359 257 331 569 541 53 79 47 349

521 157 367 107 487 139 503 61 173 347

 

S = 3092

41 491 599 487 373 229 541 73 79 179

397 101 137 167 461 127 557 523 263 359

449 251 383 107 197 149 191 521 401 443

569 139 587 479 83 317 181 241 257 239

601 367 109 89 509 157 43 593 277 347

193 463 467 389 281 607 113 97 379 103

163 547 409 499 59 439 223 173 311 269

71 53 61 211 571 563 433 131 577 421

271 613 293 233 227 353 307 283 199 313

337 67 47 431 331 151 503 457 349 419

 

S=3500

71 211 257 223 587 643 443 313 613 139

379 653 491 293 167 227 503 97 439 251

191 563 137 409 569 269 353 523 113 373

521 101 271 617 431 367 73 557 173 389

383 131 311 179 401 359 397 547 283 509

157 499 577 337 233 541 83 347 619 107

421 109 229 197 599 151 419 103 641 631

263 601 457 479 307 239 281 331 193 349

467 433 163 317 79 241 487 593 149 571

647 199 607 449 127 463 461 89 277 181

 

S = 4222

131 149 443 607 647 619 521 499 257 349

139 431 547 293 137 587 523 389 467 709

701 317 359 379 263 577 197 227 571 631

617 509 653 251 673 503 421 151 277 167

191 593 229 449 179 661 397 719 457 347

223 419 269 641 401 601 563 233 463 409

599 479 383 271 613 173 541 461 491 211

557 311 367 659 193 181 199 733 283 739

337 331 281 433 677 157 487 569 643 307

727 683 691 239 439 163 373 241 313 353

 

S = 4780

179 227 617 479 571 599 541 463 331 773

491 311 523 661 251 487 313 691 433 619

439 653 263 701 719 397 751 353 211 293

709 449 257 277 521 683 613 223 587 461

769 641 421 181 733 419 349 431 457 379

271 347 743 337 563 673 191 199 809 647

569 797 317 283 383 241 643 557 601 389

443 757 307 727 409 269 281 787 607 193

233 359 739 373 401 503 467 499 547 659

677 239 593 761 229 509 631 577 197 367

 

S=5608

251 281 809 491 661 619 263 631 863 739

409 857 571 641 593 599 479 389 283 787

659 587 557 577 547 683 827 317 541 313

353 601 347 821 257 769 859 743 509 349

761 431 271 269 331 653 727 773 569 823

379 677 643 673 487 383 719 523 373 751

883 521 881 359 421 563 367 401 709 503

797 439 757 449 647 293 467 733 607 419

839 877 311 499 811 433 443 397 691 307

277 337 461 829 853 613 457 701 463 617

 

S=7124

389 457 853 751 857 809 709 811 719 769

431 773 1013 733 877 971 739 401 677 509

563 823 467 409 421 997 547 887 977 1033

1009 859 587 1021 499 397 617 967 521 647

443 577 727 827 1039 937 593 821 487 673

991 659 439 449 613 881 541 941 691 919

1031 743 619 641 571 503 911 479 1019 607

983 757 829 1049 701 599 797 419 433 557

653 523 929 601 863 569 787 491 761 947

631 953 661 643 683 461 883 907 839 463

 

S=10126

661 829 683 1013 907 1171 1181 1217 1187 1277

1291 1237 809 1279 1063 797 743 1201 883 823

1039 733 857 1307 1097 827 1259 937 709 1361

821 859 1327 953 971 1297 769 1129 1249 751

1049 1019 1321 991 1109 1163 967 727 1103 677

1367 1231 1117 739 887 1087 673 853 1021 1151

701 1093 1009 787 947 977 1229 1319 1303 761

997 1153 1193 983 811 839 1373 863 691 1223

911 941 929 773 1051 1091 1213 1123 1061 1033

1289 1031 881 1301 1283 877 719 757 919 1069

 

S=10198

673 853 1009 859 1123 1063 971 1163 1103 1381

1069 1109 677 809 937 997 1213 1373 1187 827

1171 1193 907 1259 757 701 1249 911 743 1307

1327 1021 1097 863 761 1217 1229 881 709 1093

1087 821 1223 1291 1361 953 787 887 769 1019

857 811 1297 1129 1049 1301 929 1151 991 683

1367 1303 967 829 983 1031 877 941 1061 839

1051 691 719 1201 1277 1237 739 733 1319 1231

773 1117 1013 1039 797 947 1321 1181 1283 727

823 1279 1289 919 1153 751 883 977 1033 1091

 

S = 11212

769 863 1171 967 859 1381 1237 1459 1289 1217

1163 953 797 1297 1049 1021 1303 977 1423 1229

809 1277 1153 937 1151 1409 1291 839 1249 1097

1429 1231 1193 1451 1061 829 821 1361 823 1013

1453 997 947 1091 1321 887 1283 941 811 1481

1069 1201 1427 1129 907 919 1373 1039 1117 1031

1009 1123 1301 1093 1367 1483 911 1051 1087 787

991 1109 1279 877 1223 929 1187 1433 1327 857

1213 1439 1063 971 1447 883 773 1259 983 1181

1307 1019 881 1399 827 1471 1033 853 1103 1319

In the case of 27180, the primes to be organised into the 10 x 10 magic square are:

2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121

Friday, 31 March 2023

Digitally Balanced Numbers

I've recently made a post about Balanced Numbers on March 24th 2023. Shortly, I'll turn 27027 days old and 27027 is a balanced number because to the left and right of the zero, the sum of the digits is the same:$$ 27027 = \overbrace{27}^{2+7=9} \cdot 0 \cdot \overbrace{27}^{2+7=9} \text{ is a balanced number}$$On the other hand, a digitally balanced number in base \(b\) is a number in which all the digits \(0, 1, 2, \dots , (b-1) \) occur an equal number of times. The number associated with my diurnal age today is 27025 and this number is digitally balanced in base 6, being equal to 325041.$$27025_{10}=325041_6 \text{ is digitally balanced in base 6}$$This property qualifies it for membership in OEIS A049357:


 A049357

Digitally balanced numbers in base 6: equal numbers of 0's, 1's, ..., 5's.    



The smallest such number will be \(102345_6 = 8345_{10} \) and the largest, with each digit occurring once, is \(543210_6 = 44790_{10}\). There are 600 digitally balanced numbers in this range so I won't list them all here but I'll provide a permalink to generate these numbers using SageMathCell. Numbers Aplenty provides a list of the first 600 digitally balanced numbers in any base. The same source illustrates the smallest 3 × 3 magic square made of consecutive balanced numbers in any base and which corresponds to which corresponds to the nine consecutive numbers 14924, 14917, 14922, 14919, 14921, 14923, 14920, 14925, and 14918. See Figure 1.

Figure 1: source

I must confess to having given digitally balanced numbers scant attention over the years, even though Numbers Aplenty regularly lists their occurrence. Numbers can be digitally balanced in more than one base. Below is a list of numbers that are digitally balanced in bases 2 and 4 (permalink):

Base 2    Base 10     Base 4

10000111 --> 135 --> 2013
10001101 --> 141 --> 2031
10010011 --> 147 --> 2103
10011100 --> 156 --> 2130
10110001 --> 177 --> 2301
10110100 --> 180 --> 2310
11000110 --> 198 --> 3012
11001001 --> 201 --> 3021
11010010 --> 210 --> 3102
11011000 --> 216 --> 3120
11100001 --> 225 --> 3201
11100100 --> 228 --> 3210

The algorithm listed earlier is easily  modified to accommodate other bases. For example, in base 7, the smallest number will be
\(1023456_7=123717_{10}\) and the largest, with each digit occurring once, will be \(6543210_7= 800667_{10}\). There are 4320 numbers in the range and they form part of OEIS A049358 (permalink):


 A049358

Digitally balanced numbers in base 7: equal numbers of 0's, 1's, ..., 6's.         
  


There is an overlap between digitally balanced numbers and pandigital numbers. When the digits in a digitally balanced number occur only once, then it is a pandigital number because its digits span all the possible digits in the number base. So \(27025_{10}=325041_6\) is pandigital in base 6 as well as being digitally balanced in that base.

Friday, 12 November 2021

Ultramagic Squares

Here is a definition of an ultramagic square:

A magic square is associative if the sum of any two elements symmetric about its center is the same. A magic square is pandiagonal if the sum of the numbers in any broken diagonal equals the magic constant. A magic square is ultramagic if it is associative and pandiagonal. Ultramagic squares exist for orders n>=5. Source.

Using this as a starting point, let's understand what is meant by a pandiagonal magic square. Here is a definition taken from a most useful website:

Pandiagonal magic squares are magic squares, where also the broken diagonals sum to the magic constant. This means when you go off of one edge on a diagonal, continue (wrap-around) to the corresponding cell on the opposite edge. These squares are considered as one of the top classes of magic squares.

Figures 1 and 2 show clearly what is meant by a "broken diagonal" and show a 5 x 5 magic square that is pandiagonal. 


Figure 1


Figure 2

The magic square in Figures 1 and 2 however, is not associative. Using the central square (24) as a reference point, we note that, up-down 3 + 12 = 15 but left-right 20 + 6 = 26. These must be equal for a magic square to be associative. Figure 3 shows a 5 x 5 magic square that is both pandiagonal and associative, and thus ultramagic.

Figure 3

The magic constant for this square is 65 and it can be seen that all rows, columns, main diagonals and broken diagonals all add to this number. Furthermore, the up-down 6 + 20 = 26 and the left-right 2 + 24 = 26 are this time equal as are all the other symmetric pairs of elements.

Figure 3 shows a 7 x 7 ultramagic square:


Figure 4: source

Figures 5, 6 and 7 show 6 x 6, 7 x 7 and 8 x 8 prime ultramagic squares with magic constants of 990, 4613 and 2040 respectively:
Figure 5: source


Figure 6: source


Figure 8: source

These magic constants (990, 4613 and 2040) are the lowest possible and form part of OEIS A257316:


 A257316

Smallest magic constant of ultramagic squares of order \(n\) composed of distinct prime numbers.


The sequence runs 3505, 990, 4613, 2040 with 3505 being the magic constant (not shown) for the 5 x 5 ultramagic square with minimal magic constant. The following bounds for the next terms are known:
  • 12249 <=a(9) <=13059
  • 4200 <=a(10) <=46150
  • a(11) >= 26521
  • a(12) >= 8820
  • a(13) >= 49439
  • a(14) >= 16170
  • a(15) >= 74595
  • a(16) >= 21840
My attention was attracted to the topic because today I turned 26521 days old and this number happens to be the lower bound for the 11 x 11 prime ultramagic square with minimal magic constant. The exact composition of such a square is presumably still not known.

My earlier posts on Magic Squares are:

Monday, 17 May 2021

Prime Semi-Magic Squares

 I've posted about magic squares (and cubes) before, specifically:

Yesterday, I turned 26339 days old and one of the properties of this prime number is that it's a member of OEIS A270865:


 A270865

Smallest primes of 4 X 4 semi-magic squares formed from consecutive primes. 
 

A semi-magic square has all its rows and columns adding to a constant number, but not its diagonals. Up to 26339, the OEIS sequence runs:
5, 19, 29, 31, 37, 47, 53, 79, 397, 409, 599, 787, 1229, 1381, 1439, 1993, 2087, 2767, 4003, 4159, 4931, 5791, 5981, 8117, 9293, 9349, 9833, 10939, 10979, 11213, 12553, 12907, 14557, 16361, 18047, 21089, 21557, 21577, 25903, 26339

In the OEIS comments for the sequence, examples are shown for 5 and 19:$$\begin{array}{|c|c|c|c|}

\hline 5 & 7 & 53 & 59 \\

\hline 29 & 61 & 23 & 11\\

\hline 43 & 37 & 31 & 13\\

\hline 47 & 19 & 17 & 41 \\

\hline

\end{array}$$ $$\begin{array}{|c|c|c|c|}

\hline 19 & 23 & 79 & 83 \\

\hline 53 & 67 & 37 & 47\\

\hline 61 & 41 & 59 & 43 \\

\hline 71 & 73 & 29 & 31 \\

\hline


\end{array}$$In the magic square beginning with 5, the 16 primes (5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61) total 496 and every row and column totals 496 ÷ 4 = 124 which is the magic constant of the square. The sum total of the primes must always be a multiple of 4. We know the next set of primes starts with 19 so what happens if we use a set of primes starting with 7, 11, 13 and 17:

  • 7 gives a total of 558 which is not divisible by 4
  • 11 gives a total of 662 which is not divisible by 4
  • 13 gives a total of 684 which is divisible by 4 to give 171
  • 17 gives a total of 750 which is not divisible by 4
From this we can see that divisibility of the prime sum by 4 is a necessary but not sufficient condition for ensuring that a semi-magic square can be created. 13 serves as a reminder of this. A little thought reveals that for an \(n \times n \) magic square, not only must the sum of the terms be divisible by \(n\), the quotient must be even when \(n\) is even and odd when \(n\) is odd. As can be seen, if we start with 13 as the first consecutive prime, the quotient is odd. The reason is that in the case of a 4 x 4 magic square, each column and row consists of four odd primes that when added together must produce an even total.

In the case of 26339, the primes are:

26339, 26347, 26357, 26371, 26387, 26393, 26399, 26407, 
26417, 26423, 26431, 26437, 26449, 26459, 26479, 26489

These primes total 422584 and thus the magic constant is 105646. The problem is how to arrange these primes into a semi-magic square. As can be seen, the pattern of the placement of primes is different between the semi-magic square beginning with 5 and the one beginning with 19. It seems as if each arrangement of numbers might be unique. I tried using the same pattern as found in Durer's famous 4 x 4 magic square but no luck. There are a staggering 20,922,789,888,000 or over twenty trillion ways to form a 4 x 4 grid of 16 numbers  and even SageMathCell cannot search through all these possibilities. What I'm looking for is a method to populate a 4 x 4 semi-magic square with 16 non-consecutive elements.

The number of groups of primes making up the 4 x 4 semi-magic squares are relatively rare. 26339 marks the first member of the 40th such group. Not surprisingly, the number of groups of primes making up 4 x 4 fully magic squares are ever rarer. The following sequence begins 31, 37, 1229, 4931, 12553, 3259909, 3324329, 9291521, ...


 A260673

Smallest primes of 4 X 4 magic squares formed from consecutive primes.   


Here is the magic square of consecutive primes beginning with 37. It has a magic constant of 258:$$\begin{array}{|c|c|c|c|}\hline 37 & 83 & 97 & 41 \\
\hline 53 & 61 & 71 & 73\\

\hline 89 & 67 & 59 & 43\\

\hline 79 & 47 & 31 & 101 \\

\hline

\end{array}$$This of course doesn't solve my problem of how to arrange the primes in my 4 x 4 semi-magic square with its magic constant of 105646. One thing to consider would be the gaps between the primes. These average of these gaps is 10 and the actual gaps are:

26339 to 26347 is a gap of 08 with total of 008
26347 to 26357 is a gap of 10 with total of 018
26357 to 26371 is a gap of 14 with total of 032
26371 to 26387 is a gap of 16 with total of 048
26387 to 26393 is a gap of 06 with total of 054
26393 to 26399 is a gap of 06 with total of 060
26399 to 26407 is a gap of 08 with total of 068
26407 to 26417 is a gap of 10 with total of 078
26417 to 26423 is a gap of 06 with total of 084
26423 to 26431 is a gap of 08 with total of 092
26431 to 26437 is a gap of 06 with total of 098
26437 to 26449 is a gap of 12 with total of 110
26449 to 26459 is a gap of 10 with total of 120
26459 to 26479 is a gap of 20 with total of 140
26479 to 26489 is a gap of 10 with total of 150

The reason I've listed these gaps between the primes is that a lot of importance seems placed on numbers been in arithmetic progression. At this location on Quora, there is a method shown for filling the traditional 4 x 4 magic square with the numbers from 1 to 16. See Figure 1.

Figure 1: source

I tried this using my prime numbers with 26339 replacing 1, 26347 replacing 2 etc. but it didn't work. So my search continues but along the way I've discovered new types of magic squares. For example, bimagic means a magic square remaining magic after each of its numbers have been squared. The smallest possible 4×4 semi-bimagic square of prime numbers begins with 29 and is shown in Figure 2:
Figure 2: source

For this magic square, the magic constant is 1190 and when the terms are squared, the magic constant becomes 549100. Lots of interesting information on magic squares to be found at the source site listed in Figure 2.

The knight's tour often comes up in the construction of magic squares as can be seen in this initial populating of the squares in Figure 3. A knight's tour is only possible on a board with an even number of squares. However, it is apparently not possible on a 4 x 4 board. In fact, the 5 x 6 and 3 x 10 boards are the smallest rectangular boards that have knight's tours. Source.

Figure 3: source

From the same source as listed in Figure 3, the method shown in Figure 4 is suggested as a way to arrange 16 elements into a 4 x 4 magic square:

Figure 4: source

I'm wondering if this strategy might be successful if used with the gaps that I've listed between the primes. I don't have four of every \(a,b,x,y\) but my magic square only needs to be semi-magic. In Figure 2, the knight moves can be seen in the path between \(a\) and \(a+x\), \(b\) and \(b+x\) etc. So far though no luck. I'll keep trying and add to this post when I succeed.

It can be noted that 26339, the first prime in the set of 16 primes that I'm trying to arrange into a semi-magic square, is a Luhn prime of the first order because 26339 + 93362 = 119701 which is a prime number. This is the property that defines a Luhn prime, namely that the prime number itself when added to its reverse, produces a new prime. I posted about Luhn Primes in a post on my birthday, April 3rd 2021. However, this property of 26339 doesn't seem to help in solving my problem.

One approach is to subtract 26339 from every term so that the sequence starts with zero. This gives: 0, 8, 18, 32, 48, 54, 60, 68, 78, 84, 92, 98, 110, 120, 140, 150 and these terms have a median of 73. If we subtract 73 from each we get:

-73, -65, -55, -41, -25, -19, -13, -5, 5, 11, 19, 25, 37, 47, 67, 77

The magic constant for this set of numbers is -2. If I subtract 72, the magic constant is 2, so a magic constant of zero isn't possible. Perhaps it will be easier to work with these smaller numbers. If I come up with a semi-magic square for these numbers, then I simply need to add 26339 + 73 = 21412 to the numbers above.

Sunday, 11 October 2020

Nude Numbers

It was only in my previous post that I mentioned Friedman numbers, named after the former Associate Professor of Mathematics at Stetson University in DeLand, Florida. His name popped up again this morning when I was investigating the number associated with my diurnal age: 26124. Before discussing the mathematical property of this number, namely its "nudity", I'll include some biographical information about Erich Friedman that I found on his website:

My name is Erich Friedman. For 26 years, I was a Professor of Mathematics at Stetson University, located in DeLand, Florida. I retired in 2018 to spend more time on my other interests, including recreational mathematics, puzzles, trivia, and my girlfriend of 30 years. I was born in 1965 in West Lafayette, Indiana. I grew up in Indianapolis and went to North Central High School. I got my bachelor's degree from Rose-Hulman in 1987, and my Ph.D. from Cornell University in 1991, and have been at Stetson ever since.

There's more information on his website but that's enough for this post. Suffice to say that his website looks interesting with many links to mathematical topics. Eric Friedman is the author of OEIS A034838: numbers \(n\) that are divisible by every digit of \(n\). 26214 is a member of this sequence because 1, 2, 4 and 6 do indeed divide into it without remainder.

I was lead to this sequence by a link in Numbers Aplenty concerning what are colorfully called nude numbers, so called because such numbers expose some of their factors. The explanation on the Numbers Aplenty website runs like this:

Y.Katagiri calls a number nude if it is divisible by all of its digits (which should be nonzero) like \(672=6\cdot112=7\cdot96=2\cdot 336\). The number is called "nude" because it exposes some of its factors. There are only \(9039\) such numbers below one million, however there are infinite nude numbers since all repdigits are nude. The smallest nude number which contains all the odd digits is \(1117935\). Note that if a nude number contains a \(5\), then all the other digits must be odd. The smallest nude \(n\) which contains the maximal (8) number of distinct digits is \(1123449768\). The smallest triple of consecutive nontrivial nude numbers is \((1111, 1112, 1113)\). It is easy to see that there cannot be four consecutive nude numbers greater than 10.

The entry goes on to depict the smallest 3 × 3 magic square whose entries are nontrivial consecutive nude numbers (that is, not the numbers from 1 to 9). See Figure 1.

Figure 1

It's easy enough to generate all the nude numbers from 1 to 26124 using the SageMath code shown below (permalink to SageMathCell):

L=[]
for n in [1..26124]:
    N=n.digits()
    OK=1
    for i in range(len(N)):
        if N[i]==0:
            OK=0
            break
        else:
            if n%N[i]!=0:
                OK=0
                break
    if OK==1:
        L.append(n)
print(L)
print("The percentage of nude numbers up to",n,"is",numerical_approx(len(L)/n*100,digits=2))

The output tells us that approximately 2.9% of the numbers between 1 and 26124 are nude. Here is output:

[1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 22, 24, 33, 36, 44, 48, 55, 66, 77, 88, 99, 111, 112, 115, 122, 124, 126, 128, 132, 135, 144, 155, 162, 168, 175, 184, 212, 216, 222, 224, 244, 248, 264, 288, 312, 315, 324, 333, 336, 366, 384, 396, 412, 424, 432, 444, 448, 488, 515, 555, 612, 624, 636, 648, 666, 672, 728, 735, 777, 784, 816, 824, 848, 864, 888, 936, 999, 1111, 1112, 1113, 1115, 1116, 1122, 1124, 1128, 1131, 1144, 1155, 1164, 1176, 1184, 1197, 1212, 1222, 1224, 1236, 1244, 1248, 1266, 1288, 1296, 1311, 1326, 1332, 1335, 1344, 1362, 1368, 1395, 1412, 1416, 1424, 1444, 1448, 1464, 1488, 1515, 1555, 1575, 1626, 1632, 1644, 1662, 1692, 1715, 1722, 1764, 1771, 1824, 1848, 1888, 1926, 1935, 1944, 1962, 2112, 2122, 2124, 2128, 2136, 2144, 2166, 2184, 2196, 2212, 2222, 2224, 2226, 2232, 2244, 2248, 2262, 2288, 2316, 2322, 2328, 2364, 2412, 2424, 2436, 2444, 2448, 2488, 2616, 2622, 2664, 2688, 2744, 2772, 2824, 2832, 2848, 2888, 2916, 3111, 3126, 3132, 3135, 3144, 3162, 3168, 3171, 3195, 3216, 3222, 3264, 3276, 3288, 3312, 3315, 3324, 3333, 3336, 3339, 3366, 3384, 3393, 3432, 3444, 3492, 3555, 3612, 3624, 3636, 3648, 3666, 3717, 3816, 3864, 3888, 3915, 3924, 3933, 3996, 4112, 4116, 4124, 4128, 4144, 4164, 4172, 4184, 4212, 4224, 4236, 4244, 4248, 4288, 4332, 4344, 4368, 4392, 4412, 4416, 4424, 4444, 4448, 4464, 4488, 4632, 4644, 4824, 4848, 4872, 4888, 4896, 4932, 4968, 5115, 5155, 5355, 5515, 5535, 5555, 5775, 6126, 6132, 6144, 6162, 6168, 6192, 6216, 6222, 6264, 6288, 6312, 6324, 6336, 6366, 6384, 6432, 6444, 6612, 6624, 6636, 6648, 6666, 6696, 6762, 6816, 6864, 6888, 6912, 6966, 6984, 7112, 7119, 7175, 7224, 7266, 7371, 7448, 7476, 7644, 7728, 7777, 7784, 8112, 8128, 8136, 8144, 8184, 8224, 8232, 8248, 8288, 8328, 8424, 8448, 8488, 8496, 8616, 8664, 8688, 8736, 8824, 8832, 8848, 8888, 8928, 9126, 9135, 9144, 9162, 9216, 9288, 9315, 9324, 9333, 9396, 9432, 9612, 9648, 9666, 9864, 9936, 9999, 11111, 11112, 11115, 11122, 11124, 11128, 11133, 11136, 11144, 11155, 11166, 11172, 11184, 11196, 11212, 11222, 11224, 11226, 11232, 11244, 11248, 11262, 11288, 11313, 11316, 11322, 11328, 11331, 11355, 11364, 11412, 11424, 11436, 11444, 11448, 11488, 11515, 11535, 11555, 11616, 11622, 11664, 11676, 11688, 11711, 11824, 11832, 11848, 11872, 11888, 11916, 12112, 12122, 12124, 12126, 12128, 12132, 12144, 12162, 12168, 12184, 12212, 12216, 12222, 12224, 12244, 12248, 12264, 12288, 12312, 12324, 12336, 12366, 12384, 12412, 12424, 12432, 12444, 12448, 12488, 12492, 12612, 12624, 12636, 12648, 12666, 12712, 12726, 12768, 12816, 12824, 12848, 12864, 12888, 12924, 12996, 13113, 13116, 13122, 13128, 13131, 13155, 13164, 13212, 13224, 13236, 13248, 13266, 13272, 13311, 13326, 13332, 13335, 13344, 13362, 13368, 13377, 13392, 13416, 13464, 13488, 13515, 13626, 13632, 13644, 13662, 13713, 13755, 13776, 13797, 13824, 13848, 13896, 13932, 13968, 13995, 14112, 14124, 14128, 14136, 14144, 14184, 14212, 14224, 14232, 14244, 14248, 14288, 14292, 14316, 14328, 14364, 14412, 14424, 14436, 14444, 14448, 14488, 14616, 14664, 14688, 14728, 14784, 14824, 14832, 14848, 14888, 15115, 15135, 15155, 15315, 15515, 15555, 15575, 15715, 16116, 16122, 16128, 16164, 16212, 16224, 16236, 16248, 16266, 16326, 16332, 16344, 16362, 16368, 16416, 16464, 16488, 16626, 16632, 16644, 16662, 16716, 16824, 16848, 16992, 17115, 17122, 17136, 17171, 17199, 17248, 17262, 17444, 17472, 17535, 17717, 17724, 17766, 17955, 18112, 18128, 18144, 18168, 18184, 18216, 18224, 18248, 18264, 18288, 18312, 18336, 18384, 18424, 18432, 18448, 18488, 18624, 18648, 18816, 18824, 18848, 18864, 18872, 18888, 18936, 19116, 19224, 19296, 19332, 19368, 19395, 19692, 19719, 19926, 19935, 19944, 19962, 19971, 21112, 21122, 21124, 21126, 21128, 21132, 21144, 21162, 21168, 21184, 21212, 21216, 21222, 21224, 21244, 21248, 21264, 21288, 21312, 21324, 21336, 21366, 21384, 21412, 21424, 21432, 21444, 21448, 21488, 21492, 21612, 21624, 21636, 21648, 21666, 21672, 21728, 21784, 21816, 21824, 21848, 21864, 21888, 21924, 21996, 22112, 22116, 22122, 22124, 22128, 22144, 22164, 22176, 22184, 22212, 22222, 22224, 22236, 22244, 22248, 22266, 22288, 22326, 22332, 22344, 22362, 22368, 22392, 22412, 22416, 22424, 22444, 22448, 22464, 22488, 22626, 22632, 22644, 22662, 22722, 22764, 22824, 22848, 22888, 22896, 22932, 22968, 23112, 23124, 23136, 23166, 23184, 23226, 23232, 23244, 23262, 23292, 23316, 23322, 23328, 23364, 23412, 23424, 23436, 23448, 23616, 23622, 23664, 23688, 23772, 23832, 23922, 24112, 24124, 24128, 24132, 24144, 24168, 24184, 24192, 24212, 24216, 24224, 24244, 24248, 24264, 24276, 24288, 24312, 24324, 24336, 24384, 24412, 24424, 24432, 24444, 24448, 24472, 24488, 24612, 24624, 24636, 24648, 24696, 24724, 24816, 24824, 24848, 24864, 24888, 24912, 24984, 26112, 26124] 

The percentage of nude numbers up to 26124 is 2.9


Wolfram MathWorld has some auxiliary information:
Numbers in base-10 which are divisible by their digits are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 22, 24, 33, 36, 44, 48, 55, 66, 77, 88, 99, 111, 112, 115, 122, ... (OEIS A034838). Numbers which are divisible by the sum of their digits are called Harshad numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 21, 24, ... (OEIS A005349). Numbers which are divisible by both their digits and the sum of their digits are 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36, 48, 111, 112, 126, 132, 135, 144, ... (OEIS A050104). Numbers which are equal to (i.e., not just divisible by) the product of their divisors and the sum of their divisors are called sum-product numbers and are given by 1, 135, 144, ... (OEIS A038369).